summaryrefslogtreecommitdiff
path: root/helm-files.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2012-09-20 12:54:23 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2012-09-20 12:54:23 +0200
commit32db807ef54e62ce61dce9d642cd6f3e3eefe573 (patch)
tree06a3589a60de0817653d0766f470f4a4da5bad6f /helm-files.el
parentdb0467822eb9d4b65c5dccfc87a60aadd584ddc0 (diff)
Issue #116 Fix and bind helm-c-open-file-with-default-tool in *find-files and locate.
* helm-external (helm-run-or-raise): Always pipe proc. * helm-files.el: Bind helm-c-open-file-with-default-tool in helm-find-files. Fix action transformer, always place new action to end. * helm-help.el add open file with default tool to doc. * helm-utils.el (helm-c-open-file-with-default-tool): Fix for emacs24+ (always pipe proc).
Diffstat (limited to 'helm-files.el')
-rw-r--r--helm-files.el34
1 files changed, 19 insertions, 15 deletions
diff --git a/helm-files.el b/helm-files.el
index 7035f088..a672fe30 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -274,6 +274,7 @@ This happen only in `helm-find-files'."
(define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window)
(define-key map (kbd "C-c C-o") 'helm-ff-run-switch-other-frame)
(define-key map (kbd "C-c C-x") 'helm-ff-run-open-file-externally)
+ (define-key map (kbd "C-c X") 'helm-ff-run-open-file-with-default-tool)
(define-key map (kbd "M-!") 'helm-ff-run-eshell-command-on-file)
(define-key map (kbd "C-=") 'helm-ff-run-ediff-file)
(define-key map (kbd "C-c =") 'helm-ff-run-ediff-merge-file)
@@ -374,6 +375,7 @@ Don't set it directly, use instead `helm-ff-auto-update-initial-value'.")
. helm-c-insert-file-name-completion-at-point)
("Open file externally `C-c C-x, C-u to choose'"
. helm-c-open-file-externally)
+ ("Open file with default tool" . helm-c-open-file-with-default-tool)
("Grep File(s) `M-g s, C-u Recurse'" . helm-find-files-grep)
("Zgrep File(s) `M-g z, C-u Recurse'" . helm-ff-zgrep)
("Switch to Eshell `M-e'" . helm-ff-switch-to-eshell)
@@ -905,6 +907,13 @@ See `helm-ff-serial-rename-1'."
(when helm-alive-p
(helm-c-quit-and-execute-action 'helm-c-open-file-externally)))
+;;;###autoload
+(defun helm-ff-run-open-file-with-default-tool ()
+ "Run open file externally command action from `helm-c-source-find-files'."
+ (interactive)
+ (when helm-alive-p
+ (helm-c-quit-and-execute-action 'helm-c-open-file-with-default-tool)))
+
(defun helm-ff-locate (candidate)
"Locate action function for `helm-find-files'."
(helm-locate-set-command)
@@ -1608,31 +1617,26 @@ is non--nil."
"Action transformer for `helm-c-source-find-files'."
(cond ((with-helm-current-buffer
(eq major-mode 'message-mode))
- (append (subseq actions 0 4)
- '(("Gnus attach file(s)" . helm-ff-gnus-attach-files))
- (subseq actions 4)))
+ (append actions
+ '(("Gnus attach file(s)" . helm-ff-gnus-attach-files))))
((string-match (image-file-name-regexp) candidate)
- (append (subseq actions 0 4)
+ (append actions
'(("Rotate image right `M-r'" . helm-ff-rotate-image-right)
- ("Rotate image left `M-l'" . helm-ff-rotate-image-left))
- (subseq actions 4)))
+ ("Rotate image left `M-l'" . helm-ff-rotate-image-left))))
((string-match "\.el$" (helm-aif (helm-marked-candidates)
(car it) candidate))
- (append (subseq actions 0 4)
+ (append actions
'(("Byte compile lisp file(s) `M-B, C-u to load'"
. helm-find-files-byte-compile)
- ("Load File(s) `M-L'" . helm-find-files-load-files))
- (subseq actions 4)))
+ ("Load File(s) `M-L'" . helm-find-files-load-files))))
((and (string-match "\.html?$" candidate)
(file-exists-p candidate))
- (append (subseq actions 0 4)
- '(("Browse url file" . browse-url-of-file))
- (subseq actions 5)))
+ (append actions
+ '(("Browse url file" . browse-url-of-file))))
((or (string= (file-name-extension candidate) "pdf")
(string= (file-name-extension candidate) "PDF"))
- (append (subseq actions 0 4)
- '(("Pdfgrep File(s)" . helm-ff-pdfgrep))
- (subseq actions 5)))
+ (append actions
+ '(("Pdfgrep File(s)" . helm-ff-pdfgrep))))
(t actions)))
(defun helm-ff-gnus-attach-files (candidate)