diff options
-rw-r--r-- | helm-external.el | 3 | ||||
-rw-r--r-- | helm-files.el | 34 | ||||
-rw-r--r-- | helm-help.el | 2 | ||||
-rw-r--r-- | helm-locate.el | 1 | ||||
-rw-r--r-- | helm-utils.el | 21 |
5 files changed, 35 insertions, 26 deletions
diff --git a/helm-external.el b/helm-external.el index 0373fb6c..e0478c1d 100644 --- a/helm-external.el +++ b/helm-external.el @@ -87,7 +87,8 @@ When FILE argument is provided run EXE with FILE. In this case EXE must be provided as \"EXE %s\"." (lexical-let* ((real-com (car (split-string (replace-regexp-in-string "%s" "" exe)))) - (proc (if file (concat real-com " " file) real-com))) + (proc (if file (concat real-com " " file) real-com)) + process-connection-type) (if (get-process proc) (if helm-raise-command (shell-command (format helm-raise-command real-com)) 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) diff --git a/helm-help.el b/helm-help.el index ac42875e..5bda73bc 100644 --- a/helm-help.el +++ b/helm-help.el @@ -230,6 +230,7 @@ This list is customizable, see `helm-buffers-favorite-modes'. \\[helm-ff-run-switch-other-window]\t\t->Switch other window. \\[helm-ff-run-switch-other-frame]\t\t->Switch other frame. \\[helm-ff-run-open-file-externally]\t\t->Open file with external program (C-u to choose). +\\[helm-ff-run-open-file-with-default-tool]\t\t->Open file externally with default tool. \\[helm-ff-rotate-left-persistent]\t\t->Rotate Image Left. \\[helm-ff-rotate-right-persistent]\t\t->Rotate Image Right. \\[helm-find-files-down-one-level]\t\t->Go down precedent directory. @@ -295,6 +296,7 @@ This list is customizable, see `helm-buffers-favorite-modes'. \\[helm-ff-run-etags]\t\t->Run etags (C-u use tap, C-u C-u reload DB). \\[helm-yank-text-at-point]\t\t->Yank text at point. \\[helm-ff-run-open-file-externally]\t\t->Open file with external program (C-u to choose). +\\[helm-ff-run-open-file-with-default-tool]\t\t->Open file externally with default tool. \nLocate tips: You can add after writing search pattern any of the locate command line options. e.g -b, -e, -n <number>...etc. diff --git a/helm-locate.el b/helm-locate.el index ea3bfb54..77b30dd0 100644 --- a/helm-locate.el +++ b/helm-locate.el @@ -96,6 +96,7 @@ the opposite of \"locate\" command." (define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window) (define-key map (kbd "M-i") 'helm-ff-properties-persistent) (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-etags) (define-key map (kbd "C-w") 'helm-yank-text-at-point) (define-key map (kbd "C-c ?") 'helm-generic-file-help) diff --git a/helm-utils.el b/helm-utils.el index eac02f2e..5ea1ab23 100644 --- a/helm-utils.el +++ b/helm-utils.el @@ -614,16 +614,17 @@ Useful in dired buffers when there is inserted subdirs." (defun helm-c-open-file-with-default-tool (file) "Open FILE with the default tool on this platform." - (if (eq system-type 'windows-nt) - (helm-w32-shell-execute-open-file file) - (start-process "helm-c-open-file-with-default-tool" - nil - (cond ((eq system-type 'gnu/linux) - "xdg-open") - ((or (eq system-type 'darwin) ;; Mac OS X - (eq system-type 'macos)) ;; Mac OS 9 - "open")) - file))) + (let (process-connection-type) + (if (eq system-type 'windows-nt) + (helm-w32-shell-execute-open-file file) + (start-process "helm-c-open-file-with-default-tool" + nil + (cond ((eq system-type 'gnu/linux) + "xdg-open") + ((or (eq system-type 'darwin) ;; Mac OS X + (eq system-type 'macos)) ;; Mac OS 9 + "open")) + file)))) (defun helm-c-open-dired (file) "Opens a dired buffer in FILE's directory. If FILE is a |