emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/helm 1a216854ad 2/2: Add macros for creating interactive c


From: ELPA Syncer
Subject: [nongnu] elpa/helm 1a216854ad 2/2: Add macros for creating interactive commands from actions
Date: Sat, 27 Aug 2022 07:58:35 -0400 (EDT)

branch: elpa/helm
commit 1a216854adcea3155b020fff4fbaa97176640198
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Add macros for creating interactive commands from actions
    
    helm-make-command-from-action for commands exiting helm.
    helm-make-persistent-command-from-action for persistent commands.
    
    Use it helm-files commands.
    
    Fix helm-ff-toggle-basename
    No need to call it with a CANDIDATE arg as it is not an action.
    Fix preselection with icons.
    
    Fix toggle update in HFF
    It is not an action, no need to use candidate arg.
---
 helm-core.el  |  22 ++++
 helm-files.el | 341 +++++++++++++++++++++++-----------------------------------
 2 files changed, 154 insertions(+), 209 deletions(-)

diff --git a/helm-core.el b/helm-core.el
index 52c1cd6c78..f20ba07619 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -2120,6 +2120,28 @@ End:")
      (helm-set-local-variable
       'helm-display-function 'helm-display-buffer-in-own-frame)
      ,@body))
+
+(defmacro helm-make-command-from-action (symbol doc action)
+  "Make a command SYMBOL from ACTION with docstring DOC.
+The command SYMBOL will quit helm before execute.
+Argument ACTION should be an existing helm action."
+  (declare (indent defun) (debug t))
+  `(defun ,symbol ()
+     ,doc
+     (interactive)
+     (with-helm-alive-p
+       (helm-exit-and-execute-action ,action))))
+
+(defmacro helm-make-persistent-command-from-action (symbol doc psymbol action)
+  "Make a persistent command SYMBOL bound to PSYMBOL from ACTION."
+  (declare (indent defun) (debug t))
+  `(defun ,symbol ()
+     ,doc
+     (interactive)
+     (with-helm-alive-p
+       (helm-set-attr ,psymbol (cons ,action 'never-split))
+       (helm-execute-persistent-action ,psymbol))))
+
 
 ;;; helm-attributes
 ;;
diff --git a/helm-files.el b/helm-files.el
index 4ede240cef..2f1dad447b 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -1800,11 +1800,9 @@ prefix arg shell buffer doesn't exists, create it and 
switch to it."
                (length failures)
                (mapconcat (lambda (f) (format "- %s\n" f)) failures "")))))
 
-(defun helm-ff-run-touch-files ()
+(helm-make-command-from-action helm-ff-run-touch-files
   "Used to interactively run touch file action from keyboard."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-touch-files)))
+  'helm-ff-touch-files)
 (put 'helm-ff-run-touch-files 'helm-only t)
 
 (defun helm-ff-sort-by-size ()
@@ -2161,10 +2159,9 @@ COUNT is used for incrementing new name if needed."
     (helm-ff-query-replace-on-filenames marked)))
 
 ;; The command for `helm-find-files-map'.
-(defun helm-ff-run-query-replace-fnames-on-marked ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-query-replace-fnames-on-marked)))
+(helm-make-command-from-action helm-ff-run-query-replace-fnames-on-marked
+    "Run query-replace on filenames from HFF."
+  'helm-ff-query-replace-fnames-on-marked)
 (put 'helm-ff-run-query-replace-fnames-on-marked 'helm-only t)
 
 (defun helm-ff-query-replace (_candidate)
@@ -2172,24 +2169,22 @@ COUNT is used for incrementing new name if needed."
                        collect (buffer-name (find-file-noselect f)))))
     (helm-buffer-query-replace-1 nil bufs)))
 
+(helm-make-command-from-action helm-ff-run-query-replace
+    "Run query-replace from HFF."
+  'helm-ff-query-replace)
+(put 'helm-ff-run-query-replace 'helm-only t)
+
 (defun helm-ff-query-replace-regexp (_candidate)
   (let ((bufs (cl-loop for f in (helm-marked-candidates :with-wildcard t)
                        collect (buffer-name (find-file-noselect f)))))
     (helm-buffer-query-replace-1 'regexp bufs)))
 
-(defun helm-ff-run-query-replace ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-query-replace)))
-(put 'helm-ff-run-query-replace 'helm-only t)
-
-(defun helm-ff-run-query-replace-regexp ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-query-replace-regexp)))
+(helm-make-command-from-action helm-ff-run-query-replace-regexp
+    "Run query-replace regexp from HFF."
+  'helm-ff-query-replace-regexp)
 (put 'helm-ff-run-query-replace-regexp 'helm-only t)
 
-(defun helm-ff-toggle-auto-update (_candidate)
+(defun helm-ff-toggle-auto-update ()
   (if helm-ff--deleting-char-backward
       (progn
         (message "[Auto expansion disabled]")
@@ -2203,8 +2198,7 @@ COUNT is used for incrementing new name if needed."
 (defun helm-ff-run-toggle-auto-update ()
   (interactive)
   (with-helm-alive-p
-    (helm-set-attr 'toggle-auto-update '(helm-ff-toggle-auto-update . 
never-split))
-    (helm-execute-persistent-action 'toggle-auto-update)))
+    (helm-ff-toggle-auto-update)))
 (put 'helm-ff-run-toggle-auto-update 'helm-only t)
 
 (defun helm-ff-delete-char-backward ()
@@ -2300,81 +2294,59 @@ Called with a prefix arg open menu unconditionally."
   (interactive)
   (helm-ff-RET-1 t))
 
-(defun helm-ff-run-grep ()
-  "Run Grep action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-grep)))
+(helm-make-command-from-action helm-ff-run-grep
+    "Run Grep action from `helm-source-find-files'."
+  'helm-find-files-grep)
 (put 'helm-ff-run-grep 'helm-only t)
 
-(defun helm-ff-run-git-grep ()
-  "Run git-grep action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-git-grep)))
+(helm-make-command-from-action helm-ff-run-git-grep
+    "Run git-grep action from `helm-source-find-files'."
+  'helm-ff-git-grep)
 (put 'helm-ff-run-git-grep 'helm-only t)
 
-(defun helm-ff-run-grep-ag ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-ag)))
+(helm-make-command-from-action helm-ff-run-grep-ag
+    "Run grep AG action from `helm-source-find-files'."
+  'helm-find-files-ag)
 (put 'helm-ff-run-grep-ag 'helm-only t)
 
-(defun helm-ff-run-pdfgrep ()
-  "Run Pdfgrep action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-pdfgrep)))
+(helm-make-command-from-action helm-ff-run-pdfgrep
+    "Run Pdfgrep action from `helm-source-find-files'."
+  'helm-ff-pdfgrep)
 (put 'helm-ff-run-pdfgrep 'helm-only t)
 
-(defun helm-ff-run-zgrep ()
-  "Run Grep action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-zgrep)))
+(helm-make-command-from-action helm-ff-run-zgrep
+    "Run Grep action from `helm-source-find-files'."
+  'helm-ff-zgrep)
 (put 'helm-ff-run-zgrep 'helm-only t)
 
-(defun helm-ff-run-copy-file ()
-  "Run Copy file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-copy)))
+(helm-make-command-from-action helm-ff-run-copy-file
+    "Run Copy file action from `helm-source-find-files'."
+  'helm-find-files-copy)
 (put 'helm-ff-run-copy-file 'helm-only t)
 
-(defun helm-ff-run-rsync-file ()
-  "Run Rsync file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-rsync)))
+(helm-make-command-from-action helm-ff-run-rsync-file
+    "Run Rsync file action from `helm-source-find-files'."
+  'helm-find-files-rsync)
 (put 'helm-ff-run-rsync-file 'helm-only t)
 
-(defun helm-ff-run-rename-file ()
-  "Run Rename file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-rename)))
+(helm-make-command-from-action helm-ff-run-rename-file
+    "Run Rename file action from `helm-source-find-files'."
+  'helm-find-files-rename)
 (put 'helm-ff-run-rename-file 'helm-only t)
 
-(defun helm-ff-run-byte-compile-file ()
-  "Run Byte compile file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-byte-compile)))
+(helm-make-command-from-action helm-ff-run-byte-compile-file
+    "Run Byte compile file action from `helm-source-find-files'."
+  'helm-find-files-byte-compile)
 (put 'helm-ff-run-byte-compile-file 'helm-only t)
 
-(defun helm-ff-run-load-file ()
-  "Run Load file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-load-files)))
+(helm-make-command-from-action helm-ff-run-load-file
+    "Run Load file action from `helm-source-find-files'."
+  'helm-find-files-load-files)
 (put 'helm-ff-run-load-file 'helm-only t)
 
-(defun helm-ff-run-eshell-command-on-file ()
-  "Run eshell command on file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action
-     'helm-find-files-eshell-command-on-file)))
+(helm-make-command-from-action helm-ff-run-eshell-command-on-file
+    "Run eshell command on file action from `helm-source-find-files'."
+  'helm-find-files-eshell-command-on-file)
 (put 'helm-ff-run-eshell-command-on-file 'helm-only t)
 
 (defun helm-ff-run-ediff-file ()
@@ -2384,88 +2356,64 @@ Called with a prefix arg open menu unconditionally."
     (helm-exit-and-execute-action 'helm-find-files-ediff-files)))
 (put 'helm-ff-run-ediff-file 'helm-only t)
 
-(defun helm-ff-run-ediff-merge-file ()
-  "Run Ediff merge file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action
-     'helm-find-files-ediff-merge-files)))
+(helm-make-command-from-action helm-ff-run-ediff-merge-file
+    "Run Ediff merge file action from `helm-source-find-files'."
+  'helm-find-files-ediff-merge-files)
 (put 'helm-ff-run-ediff-merge-file 'helm-only t)
 
-(defun helm-ff-run-symlink-file ()
-  "Run Symlink file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-symlink)))
+(helm-make-command-from-action helm-ff-run-symlink-file
+    "Run Symlink file action from `helm-source-find-files'."
+  'helm-find-files-symlink)
 (put 'helm-ff-run-symlink-file 'helm-only t)
 
-(defun helm-ff-run-relsymlink-file ()
-  "Run Symlink file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-relsymlink)))
+(helm-make-command-from-action helm-ff-run-relsymlink-file
+    "Run Symlink file action from `helm-source-find-files'."
+  'helm-find-files-relsymlink)
 (put 'helm-ff-run-relsymlink-file 'helm-only t)
 
-(defun helm-ff-run-hardlink-file ()
-  "Run Hardlink file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-hardlink)))
+(helm-make-command-from-action helm-ff-run-hardlink-file
+    "Run Hardlink file action from `helm-source-find-files'."
+  'helm-find-files-hardlink)
 (put 'helm-ff-run-hardlink-file 'helm-only t)
 
 (defun helm-ff-delete-files (candidate)
   "Delete files default action."
   (funcall helm-ff-delete-files-function candidate))
 
-(defun helm-ff-run-delete-file ()
-  "Run Delete file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action #'helm-ff-delete-files)))
+(helm-make-command-from-action helm-ff-run-delete-file
+    "Run Delete file action from `helm-source-find-files'."
+  'helm-ff-delete-files)
 (put 'helm-ff-run-delete-file 'helm-only t)
 
-(defun helm-ff-run-complete-fn-at-point ()
-  "Run complete file name action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action
-     'helm-insert-file-name-completion-at-point)))
+(helm-make-command-from-action helm-ff-run-complete-fn-at-point
+    "Run complete file name action from `helm-source-find-files'."
+  'helm-insert-file-name-completion-at-point)
 (put 'helm-ff-run-complete-fn-at-point 'helm-only t)
 
-(defun helm-ff-run-switch-to-shell ()
-  "Run switch to eshell action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-switch-to-shell)))
+(helm-make-command-from-action helm-ff-run-switch-to-shell
+    "Run switch to eshell action from `helm-source-find-files'."
+  'helm-ff-switch-to-shell)
 (put 'helm-ff-run-switch-to-shell 'helm-only t)
 
-(defun helm-ff-run-switch-other-window ()
-  "Run switch to other window action from `helm-source-find-files'.
+(helm-make-command-from-action helm-ff-run-switch-other-window
+    "Run switch to other window action from `helm-source-find-files'.
 When a prefix arg is provided, split is done vertically."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-files-other-window)))
+  'helm-find-files-other-window)
 (put 'helm-ff-run-switch-other-window 'helm-only t)
 
-(defun helm-ff-run-switch-other-frame ()
-  "Run switch to other frame action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'find-file-other-frame)))
+(helm-make-command-from-action helm-ff-run-switch-other-frame
+    "Run switch to other frame action from `helm-source-find-files'."
+  'find-file-other-frame)
 (put 'helm-ff-run-switch-other-frame 'helm-only t)
 
-(defun helm-ff-run-open-file-externally ()
-  "Run open file externally command action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-open-file-externally)))
+(helm-make-command-from-action helm-ff-run-open-file-externally
+    "Run open file externally command action from `helm-source-find-files'."
+  'helm-open-file-externally)
 (put 'helm-ff-run-open-file-externally 'helm-only t)
 
-(defun helm-ff-run-open-file-with-default-tool ()
-  "Run open file externally command action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-open-file-with-default-tool)))
+(helm-make-command-from-action helm-ff-run-open-file-with-default-tool
+    "Run open file externally command action from `helm-source-find-files'."
+  'helm-open-file-with-default-tool)
 (put 'helm-ff-run-open-file-with-default-tool 'helm-only t)
 
 (defun helm-ff-locate (candidate)
@@ -2485,47 +2433,38 @@ When a prefix arg is provided, split is done 
vertically."
                            " -b"))))
     (helm-locate-1 helm-current-prefix-arg nil 'from-ff default)))
 
-(defun helm-ff-run-locate ()
-  "Run locate action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-locate)))
+(helm-make-command-from-action helm-ff-run-locate
+    "Run locate action from `helm-source-find-files'."
+  'helm-ff-locate)
 (put 'helm-ff-run-locate 'helm-only t)
 
 (defun helm-files-insert-as-org-link (candidate)
   (insert (format "[[%s][]]" candidate))
   (goto-char (- (point) 2)))
 
-(defun helm-ff-run-insert-org-link ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-files-insert-as-org-link)))
+(helm-make-command-from-action helm-ff-run-insert-org-link
+    "Run insert org link from HFF."
+  'helm-files-insert-as-org-link)
 (put 'helm-ff-run-insert-org-link 'helm-only t)
 
-(defun helm-ff-run-find-file-as-root ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-find-file-as-root)))
+(helm-make-command-from-action helm-ff-run-find-file-as-root
+    "Run find file as root from HFF."
+  'helm-find-file-as-root)
 (put 'helm-ff-run-find-file-as-root 'helm-only t)
 
-(defun helm-ff-run-find-alternate-file ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'find-alternate-file)))
+(helm-make-command-from-action helm-ff-run-find-alternate-file
+    "Run `find-alternate-file' from HFF."
+  'find-alternate-file)
 (put 'helm-ff-run-find-alternate-file 'helm-only t)
 
-(defun helm-ff-run-mail-attach-files ()
-  "Run mail attach files command action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-mail-attach-files)))
+(helm-make-command-from-action helm-ff-run-mail-attach-files
+    "Run mail attach files command action from `helm-source-find-files'."
+  'helm-ff-mail-attach-files)
 (put 'helm-ff-run-mail-attach-files 'helm-only t)
 
-(defun helm-ff-run-etags ()
-  "Run Etags command action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-etags-select)))
+(helm-make-command-from-action helm-ff-run-etags
+    "Run Etags command action from `helm-source-find-files'."
+  'helm-ff-etags-select)
 (put 'helm-ff-run-etags 'helm-only t)
 
 (defvar lpr-printer-switch)
@@ -2577,11 +2516,9 @@ Same as `dired-do-print' but for Helm."
         (start-process-shell-command "helm-print" nil cmd-line)
       (error "Error: Please verify your printer settings in Emacs."))))
 
-(defun helm-ff-run-print-file ()
-  "Run Print file action from `helm-source-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-print)))
+(helm-make-command-from-action helm-ff-run-print-file
+    "Run Print file action from `helm-source-find-files'."
+  'helm-ff-print)
 (put 'helm-ff-run-print-file 'helm-only t)
 
 (defun helm-ff-checksum (file)
@@ -2619,20 +2556,22 @@ Emacs and even the whole system as it eats all memory."
         (message "Calculating %s checksum for `%s' done and copied to 
kill-ring"
                  algo bn)))))
 
-(defun helm-ff-toggle-basename (_candidate)
+(defun helm-ff-toggle-basename ()
   (with-helm-buffer
     (setq helm-ff-transformer-show-only-basename
           (not helm-ff-transformer-show-only-basename))
-    (let* ((cand   (helm-get-selection nil t))
+    (let* ((cand   (helm-get-selection))
            (target (if helm-ff-transformer-show-only-basename
                        (helm-basename cand) cand)))
-      (helm-force-update (concat (regexp-quote target) "$")))))
+      (helm-force-update
+       (format helm-ff-last-expanded-candidate-regexp
+               (regexp-quote target))))))
 
 (defun helm-ff-run-toggle-basename ()
   (interactive)
   (with-helm-alive-p
     (unless (helm-empty-source-p)
-      (helm-ff-toggle-basename nil))))
+      (helm-ff-toggle-basename))))
 (put 'helm-ff-run-toggle-basename 'helm-only t)
 
 (defun helm-reduce-file-name-1 (fname level)
@@ -3039,11 +2978,9 @@ With a prefix arg toggle dired buffer to wdired mode."
         (when (or helm-current-prefix-arg current-prefix-arg)
           (call-interactively 'wdired-change-to-wdired-mode))))))
 
-(defun helm-ff-run-marked-files-in-dired ()
-  "Execute `helm-marked-files-in-dired' interactively."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-marked-files-in-dired)))
+(helm-make-command-from-action helm-ff-run-marked-files-in-dired
+    "Execute `helm-marked-files-in-dired' interactively."
+  'helm-marked-files-in-dired)
 (put 'helm-ff-run-marked-files-in-dired 'helm-only t)
 
 (defun helm-ff--create-tramp-name (fname)
@@ -3776,12 +3713,9 @@ to avoid an unnecessary call to `file-truename'."
     (helm-execute-persistent-action 'properties-action)))
 (put 'helm-ff-properties-persistent 'helm-only t)
 
-(defun helm-ff-persistent-delete ()
-  "Delete current candidate without quitting."
-  (interactive)
-  (with-helm-alive-p
-    (helm-set-attr 'quick-delete '(helm-ff-quick-delete . never-split))
-    (helm-execute-persistent-action 'quick-delete)))
+(helm-make-persistent-command-from-action helm-ff-persistent-delete
+    "Delete current candidate without quitting."
+    'quick-delete 'helm-ff-quick-delete)
 (put 'helm-ff-persistent-delete 'helm-only t)
 
 (defun helm-ff-dot-file-p (file)
@@ -3822,12 +3756,9 @@ in `helm-find-files-persistent-action-if'."
            (message "Buffer `%s' killed" buf-name))
           (t (find-file candidate)))))
 
-(defun helm-ff-run-kill-buffer-persistent ()
-  "Execute `helm-ff-kill-buffer-fname' without quitting."
-  (interactive)
-  (with-helm-alive-p
-    (helm-set-attr 'kill-buffer-fname 'helm-ff-kill-buffer-fname)
-    (helm-execute-persistent-action 'kill-buffer-fname)))
+(helm-make-persistent-command-from-action helm-ff-run-kill-buffer-persistent
+    "Execute `helm-ff-kill-buffer-fname' without quitting."
+  'kill-buffer-fname 'helm-ff-kill-buffer-fname)
 (put 'helm-ff-run-kill-buffer-persistent 'helm-only t)
 
 ;; Preview with external tool
@@ -3838,11 +3769,9 @@ in `helm-find-files-persistent-action-if'."
     (message "Please configure an external program for `*%s' file in 
`helm-external-programs-associations'"
              (file-name-extension file t))))
 
-(defun helm-ff-run-preview-file-externally ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-set-attr 'open-file-externally 
'(helm-ff-persistent-open-file-externally . never-split))
-    (helm-execute-persistent-action 'open-file-externally)))
+(helm-make-persistent-command-from-action helm-ff-run-preview-file-externally
+    "Run open file externally without quitting helm."
+  'open-file-externally 'helm-ff-persistent-open-file-externally)
 (put 'helm-ff-run-preview-file-externally 'helm-only t)
 
 (defun helm-ff-prefix-filename (fname &optional file-or-symlinkp new-file)
@@ -6386,10 +6315,9 @@ See `helm-browse-project'."
   (with-helm-default-directory helm-ff-default-directory
       (helm-browse-project helm-current-prefix-arg)))
 
-(defun helm-ff-run-browse-project ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-browse-project)))
+(helm-make-command-from-action helm-ff-run-browse-project
+    "Run browse project."
+  'helm-ff-browse-project)
 (put 'helm-ff-run-browse-project 'helm-only t)
 
 ;;; Actions calling helm and main interactive functions.
@@ -6399,10 +6327,9 @@ See `helm-browse-project'."
   (with-helm-default-directory helm-ff-default-directory
       (helm-gid)))
 
-(defun helm-ff-run-gid ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-gid)))
+(helm-make-command-from-action helm-ff-run-gid
+    "Run gid from HFF."
+  'helm-ff-gid)
 (put 'helm-ff-run-gid 'helm-only t)
 
 ;; helm-find bindings for helm-find-files.
@@ -6411,11 +6338,9 @@ See `helm-browse-project'."
   (require 'helm-find)
   (helm-find-1 helm-ff-default-directory))
 
-(defun helm-ff-run-find-sh-command ()
-  "Run find shell command action with key from `helm-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-find-sh-command)))
+(helm-make-command-from-action helm-ff-run-find-sh-command
+    "Run find shell command action with key from `helm-find-files'."
+  'helm-ff-find-sh-command)
 (put 'helm-ff-run-find-sh-command 'helm-only t)
 
 ;; helm-hd bindings for hff
@@ -6424,11 +6349,9 @@ See `helm-browse-project'."
   (require 'helm-fd)
   (helm-fd-1 helm-ff-default-directory))
 
-(defun helm-ff-run-fd ()
-  "Run fd shell command action with key from `helm-find-files'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ff-fd)))
+(helm-make-command-from-action helm-ff-run-fd
+    "Run fd shell command action with key from `helm-find-files'."
+  'helm-ff-fd)
 (put 'helm-ff-run-fd 'helm-only t)
 
 ;;;###autoload



reply via email to

[Prev in Thread] Current Thread [Next in Thread]