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

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

[nongnu] elpa/helm cca7fecf20: Use helm-make-(persistent)-command-from-a


From: ELPA Syncer
Subject: [nongnu] elpa/helm cca7fecf20: Use helm-make-(persistent)-command-from-action in more places
Date: Sat, 24 Sep 2022 06:58:33 -0400 (EDT)

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

    Use helm-make-(persistent)-command-from-action in more places
---
 helm-bookmark.el      |  36 ++++---------
 helm-buffers.el       | 139 +++++++++++++++-----------------------------------
 helm-color.el         |  24 +++------
 helm-elisp-package.el |  48 +++++++----------
 helm-grep.el          |  28 +++-------
 helm-occur.el         |  29 ++++-------
 helm-ring.el          |  27 +++-------
 helm-tags.el          |  45 ++++++++--------
 8 files changed, 121 insertions(+), 255 deletions(-)

diff --git a/helm-bookmark.el b/helm-bookmark.el
index 29731d70c2..cfd0b7fa83 100644
--- a/helm-bookmark.el
+++ b/helm-bookmark.el
@@ -512,12 +512,9 @@ If `browse-url-browser-function' is set to something else 
than
       (bookmark-get-filename candidate)
       (helm-browse-project nil)))
 
-(defun helm-bookmark-run-browse-project ()
+(helm-make-command-from-action helm-bookmark-run-browse-project
   "Run `helm-bookmark-browse-project' from keyboard."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-bookmark-browse-project)))
-(put 'helm-bookmark-run-browse-project 'helm-only t)
+  'helm-bookmark-browse-project)
 
 (defvar helm-bookmark-find-files-map
   (let ((map (make-sparse-keymap)))
@@ -759,35 +756,22 @@ consecutive words from the buffer into the new bookmark 
name."
     (unless batch (bookmark-bmenu-surreptitiously-rebuild-list))
     (helm-bookmark-maybe-save-bookmark) newname))
 
-(defun helm-bookmark-run-edit ()
+(helm-make-command-from-action helm-bookmark-run-edit
   "Run `helm-bookmark-edit-bookmark' from keyboard."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-bookmark-edit-bookmark)))
-(put 'helm-bookmark-run-edit 'helm-only t)
+  'helm-bookmark-edit-bookmark)
 
 
-(defun helm-bookmark-run-jump-other-frame ()
+(helm-make-command-from-action helm-bookmark-run-jump-other-frame
   "Jump to bookmark other frame from keyboard."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-bookmark-jump-other-frame)))
-(put 'helm-bookmark-run-jump-other-frame 'helm-only t)
+  'helm-bookmark-jump-other-frame)
 
-(defun helm-bookmark-run-jump-other-window ()
+(helm-make-command-from-action helm-bookmark-run-jump-other-window
   "Jump to bookmark from keyboard."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-bookmark-jump-other-window)))
-(put 'helm-bookmark-run-jump-other-window 'helm-only t)
+  'helm-bookmark-jump-other-window)
 
-(defun helm-bookmark-run-delete ()
+(helm-make-command-from-action helm-bookmark-run-delete
   "Delete bookmark from keyboard."
-  (interactive)
-  (with-helm-alive-p
-    (when (y-or-n-p "Delete bookmark(s)?")
-      (helm-exit-and-execute-action 'helm-delete-marked-bookmarks))))
-(put 'helm-bookmark-run-delete 'helm-only t)
+  'helm-delete-marked-bookmarks)
 
 (defun helm-bookmark-get-bookmark-from-name (bmk)
   "Return bookmark name even if it is a bookmark with annotation.
diff --git a/helm-buffers.el b/helm-buffers.el
index 5a524b3c5e..f50191b7b6 100644
--- a/helm-buffers.el
+++ b/helm-buffers.el
@@ -336,22 +336,16 @@ Note that this variable is buffer-local.")
 (defun helm-buffers-create-new-buffer-ow (candidate)
   (helm-buffers-create-new-buffer-1 candidate 'switch-to-buffer-other-window))
 
-(defun helm-buffers-not-found-run-switch-ow ()
+(helm-make-command-from-action helm-buffers-not-found-run-switch-ow
   "Run create new buffer other window action from keymap."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-buffers-create-new-buffer-ow)))
-(put 'helm-buffers-not-found-run-switch-ow 'helm-only t)
+  'helm-buffers-create-new-buffer-ow)
 
 (defun helm-buffers-create-new-buffer-of (candidate)
   (helm-buffers-create-new-buffer-1 candidate 'switch-to-buffer-other-frame))
 
-(defun helm-buffers-not-found-run-switch-of ()
+(helm-make-command-from-action helm-buffers-not-found-run-switch-of
   "Run create new buffer other frame action from keymap."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-buffers-create-new-buffer-of)))
-(put 'helm-buffers-not-found-run-switch-of 'helm-only t)
+  'helm-buffers-create-new-buffer-of)
 
 (defvar helm-buffer-not-found-map
   (let ((map (make-sparse-keymap)))
@@ -846,32 +840,21 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
   (helm-buffers-mark-similar-buffers-1 'mod)
   (helm-buffer-save-and-update nil))
 
-(defun helm-buffer-run-save-some-buffers ()
+(helm-make-persistent-command-from-action helm-buffer-run-save-some-buffers
   "Save unsaved file buffers without quitting Helm."
-  (interactive)
-  (with-helm-alive-p
-    (helm-set-attr 'save-some-action '(helm-buffer-save-some-buffers . 
never-split))
-    (helm-execute-persistent-action 'save-some-action)))
-(put 'helm-buffer-run-save-some-buffers 'helm-only t)
+  'save-some-action 'helm-buffer-save-some-buffers)
 
-(defun helm-buffer-save-persistent ()
+(helm-make-persistent-command-from-action helm-buffer-save-persistent
   "Save buffer without quitting Helm."
-  (interactive)
-  (with-helm-alive-p
-    (helm-set-attr 'save-action '(helm-buffer-save-and-update . never-split))
-    (helm-execute-persistent-action 'save-action)))
-(put 'helm-buffer-save-persistent 'helm-only t)
+'save-action 'helm-buffer-save-and-update)
 
 (defun helm-buffers-rename-buffer (candidate)
   (with-current-buffer candidate
     (rename-buffer (helm-read-string "New name: " (buffer-name)) t)))
 
-(defun helm-buffer-run-rename-buffer ()
+(helm-make-command-from-action helm-buffer-run-rename-buffer
   "Run rename buffer action from `helm-source-buffers-list'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-buffers-rename-buffer)))
-(put 'helm-buffer-run-rename-buffer 'helm-only t)
+  'helm-buffers-rename-buffer)
 
 (defun helm-switch-to-buffer-at-linum (candidate)
   (let ((linum (read-number
@@ -882,20 +865,13 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
     (goto-char (point-min))
     (forward-line (1- linum))))
 
-(defun helm-buffer-run-goto-line ()
+(helm-make-command-from-action helm-buffer-run-goto-line
   "Switch to buffer at line number."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-switch-to-buffer-at-linum)))
-(put 'helm-buffer-run-goto-line 'helm-only t)
+  'helm-switch-to-buffer-at-linum)
 
-(defun helm-buffer-run-kill-persistent ()
+(helm-make-persistent-command-from-action helm-buffer-run-kill-persistent
   "Kill buffer without quitting Helm."
-  (interactive)
-  (with-helm-alive-p
-    (helm-set-attr 'kill-action '(helm-buffers-persistent-kill . never-split))
-    (helm-execute-persistent-action 'kill-action)))
-(put 'helm-buffer-run-kill-persistent 'helm-only t)
+  'kill-action 'helm-buffers-persistent-kill)
 
 (defun helm-kill-marked-buffers (_ignore)
   (let* ((bufs (helm-marked-candidates))
@@ -906,12 +882,9 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
               helm-visible-mark-overlays nil)))
     (message "Killed %s buffer(s)" killed-bufs)))
 
-(defun helm-buffer-run-kill-buffers ()
+(helm-make-command-from-action helm-buffer-run-kill-buffers
   "Run kill buffer action from `helm-source-buffers-list'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-kill-marked-buffers)))
-(put 'helm-buffer-run-kill-buffers 'helm-only t)
+  'helm-kill-marked-buffers)
 
 (defun helm-buffer-switch-to-shell (candidate)
   (require 'helm-files)
@@ -920,46 +893,29 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
            default-directory)))
     (helm-ff-switch-to-shell nil)))
 
-(defun helm-buffer-run-switch-to-shell ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-buffer-switch-to-shell)))
-(put 'helm-buffer-run-switch-to-shell 'no-helm-mx t)
+(helm-make-command-from-action helm-buffer-run-switch-to-shell
+    "Run switch to shell action from helm-buffers-list."
+  'helm-buffer-switch-to-shell)
 
-(defun helm-buffer-run-grep ()
+(helm-make-command-from-action helm-buffer-run-grep
   "Run Grep action from `helm-source-buffers-list'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-grep-buffers)))
-(put 'helm-buffer-run-grep 'helm-only t)
+  'helm-grep-buffers)
 
-(defun helm-buffer-run-zgrep ()
+(helm-make-command-from-action helm-buffer-run-zgrep
   "Run Grep action from `helm-source-buffers-list'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-zgrep-buffers)))
-(put 'helm-buffer-run-zgrep 'helm-only t)
+  'helm-zgrep-buffers)
 
-(defun helm-buffer-run-query-replace-regexp ()
+(helm-make-command-from-action helm-buffer-run-query-replace-regexp
   "Run Query replace regexp action from `helm-source-buffers-list'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-buffer-query-replace-regexp)))
-(put 'helm-buffer-run-query-replace-regexp 'helm-only t)
+'helm-buffer-query-replace-regexp)
 
-(defun helm-buffer-run-query-replace ()
+(helm-make-command-from-action helm-buffer-run-query-replace
   "Run Query replace action from `helm-source-buffers-list'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-buffer-query-replace)))
-(put 'helm-buffer-run-query-replace 'helm-only t)
+'helm-buffer-query-replace)
 
-(defun helm-buffer-switch-other-window ()
+(helm-make-command-from-action helm-buffer-switch-other-window
   "Run switch to other window action from `helm-source-buffers-list'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-buffer-switch-buffers-other-window)))
-(put 'helm-buffer-switch-other-window 'helm-only t)
+  'helm-buffer-switch-buffers-other-window)
 
 (defun helm-buffer-switch-to-buffer-other-frame (_candidate)
   "Display marked buffers in other frame."
@@ -975,12 +931,9 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
     (with-selected-frame oframe
       (switch-to-buffer candidate))))
 
-(defun helm-buffer-switch-other-frame ()
+(helm-make-command-from-action helm-buffer-switch-other-frame
   "Run switch to other frame action from `helm-source-buffers-list'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-buffer-switch-to-buffer-other-frame)))
-(put 'helm-buffer-switch-other-frame 'helm-only t)
+  'helm-buffer-switch-to-buffer-other-frame)
 
 (defun helm-buffers-switch-to-buffer-other-tab (_candidate)
   (when (fboundp 'switch-to-buffer-other-tab)
@@ -988,13 +941,10 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
       (cl-loop for buf in bufs
                do (switch-to-buffer-other-tab buf)))))
 
-(defun helm-buffers-switch-to-buffer-new-tab ()
+(helm-make-command-from-action helm-buffers-switch-to-buffer-new-tab
   "Run switch to buffer in other tab action from `helm-source-buffers-list'."
-  (interactive)
-  (cl-assert (fboundp 'tab-bar-mode) nil "Tab-bar-mode not available")
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-buffers-switch-to-buffer-other-tab)))
-(put 'helm-buffers-switch-to-buffer-new-tab 'helm-only t)
+  'helm-buffers-switch-to-buffer-other-tab
+  (cl-assert (fboundp 'tab-bar-mode) nil "Tab-bar-mode not available"))
 
 (defun helm-buffer-switch-buffers (_candidate)
   "Switch to buffer candidates and replace current buffer.
@@ -1010,19 +960,13 @@ vertically."
   (let ((buffers (helm-marked-candidates)))
     (helm-window-show-buffers buffers t)))
 
-(defun helm-buffer-run-ediff ()
+(helm-make-command-from-action helm-buffer-run-ediff
   "Run ediff action from `helm-source-buffers-list'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ediff-marked-buffers)))
-(put 'helm-buffer-run-ediff 'helm-only t)
+  'helm-ediff-marked-buffers)
 
-(defun helm-buffer-run-ediff-merge ()
+(helm-make-command-from-action helm-buffer-run-ediff-merge
   "Run ediff action from `helm-source-buffers-list'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-ediff-marked-buffers-merge)))
-(put 'helm-buffer-run-ediff-merge 'helm-only t)
+  'helm-ediff-marked-buffers-merge)
 
 (defun helm-buffers-persistent-kill-1 (buffer-or-name)
   "Persistent action to kill buffer."
@@ -1128,12 +1072,9 @@ Can be used by any source that list buffers."
                                      (match-string 1 i)))))
     (helm-multi-occur-1 buffers input)))
 
-(defun helm-buffers-run-occur ()
+(helm-make-command-from-action helm-buffers-run-occur
   "Run `helm-multi-occur-as-action' by key."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-multi-occur-as-action)))
-(put 'helm-buffers-run-occur 'helm-only t)
+  'helm-multi-occur-as-action)
 
 (defun helm-buffers-toggle-show-hidden-buffers ()
   (interactive)
diff --git a/helm-color.el b/helm-color.el
index cc9a4c35b5..120f7cbb75 100644
--- a/helm-color.el
+++ b/helm-color.el
@@ -86,29 +86,21 @@
 (defun helm-color-kill-rgb (candidate)
   (kill-new (helm-colors-get-rgb candidate)))
 
-(defun helm-color-run-insert-name ()
+(helm-make-command-from-action helm-color-run-insert-name
   "Insert name of color from `helm-source-colors'."
-  (interactive)
-  (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-insert-name)))
-(put 'helm-color-run-insert-name 'helm-only t)
+  'helm-color-insert-name)
 
-(defun helm-color-run-kill-name ()
+(helm-make-command-from-action helm-color-run-kill-name
   "Kill name of color from `helm-source-colors'."
-  (interactive)
-  (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-kill-name)))
-(put 'helm-color-run-kill-name 'helm-only t)
+  'helm-color-kill-name)
 
-(defun helm-color-run-insert-rgb ()
+(helm-make-command-from-action helm-color-run-insert-rgb
   "Insert RGB of color from `helm-source-colors'."
-  (interactive)
-  (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-insert-rgb)))
-(put 'helm-color-run-insert-rgb 'helm-only t)
+  'helm-color-insert-rgb)
 
-(defun helm-color-run-kill-rgb ()
+(helm-make-command-from-action helm-color-run-kill-rgb
   "Kill RGB of color from `helm-source-colors'."
-  (interactive)
-  (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-kill-rgb)))
-(put 'helm-color-run-kill-rgb 'helm-only t)
+  'helm-color-kill-rgb)
 
 (defvar helm-color-map
   (let ((map (make-sparse-keymap)))
diff --git a/helm-elisp-package.el b/helm-elisp-package.el
index 692aadf43a..277541dc97 100644
--- a/helm-elisp-package.el
+++ b/helm-elisp-package.el
@@ -128,11 +128,9 @@ See `package-autoremove'."
                (propertize (symbol-name pkg)
                            'face 'font-lock-keyword-face)))))
 
-(defun helm-el-run-visit-homepage ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-el-package-visit-homepage)))
-(put 'helm-el-run-visit-homepage 'helm-only t)
+(helm-make-command-from-action helm-el-run-visit-homepage
+    "Visit package homepage from helm elisp packages."
+  'helm-el-package-visit-homepage)
 
 (defun helm-elisp-package--pkg-name (pkg)
   (if (package-desc-p pkg)
@@ -160,11 +158,9 @@ See `package-autoremove'."
 (defun helm-el-package-install (_candidate)
   (helm-el-package-install-1 (helm-marked-candidates)))
 
-(defun helm-el-run-package-install ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-el-package-install)))
-(put 'helm-el-run-package-install 'helm-only t)
+(helm-make-command-from-action helm-el-run-package-install
+    "Install package from helm elisp packages."
+  'helm-el-package-install)
 
 (defun helm-el-package-uninstall-1 (pkg-list &optional force)
   (cl-loop with mkd = pkg-list
@@ -189,11 +185,9 @@ See `package-autoremove'."
 (defun helm-el-package-uninstall (_candidate)
   (helm-el-package-uninstall-1 (helm-marked-candidates) 
helm-current-prefix-arg))
 
-(defun helm-el-run-package-uninstall ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-el-package-uninstall)))
-(put 'helm-el-run-package-uninstall 'helm-only t)
+(helm-make-command-from-action helm-el-run-package-uninstall
+    "Uninstall package from helm elisp packages."
+  'helm-el-package-uninstall)
 
 (defun helm-el-package-menu--find-upgrades ()
   (cl-loop for entry in helm-el-package--tabulated-list
@@ -262,11 +256,9 @@ See `package-autoremove'."
             if (member (symbol-name (package-desc-name pkg)) pkgs)
             collect p)))
 
-(defun helm-el-run-package-upgrade ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-el-package-upgrade)))
-(put 'helm-el-run-package-upgrade 'helm-only t)
+(helm-make-command-from-action helm-el-run-package-upgrade
+    "Uninstall package from helm elisp packages."
+  'helm-el-package-upgrade)
 
 (defun helm-el-package-upgrade-all ()
   (if helm-el-package--upgrades
@@ -282,11 +274,9 @@ See `package-autoremove'."
 (defun helm-el-package-upgrade-all-action (_candidate)
   (helm-el-package-upgrade-all))
 
-(defun helm-el-run-package-upgrade-all ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-el-package-upgrade-all-action)))
-(put 'helm-el-run-package-upgrade-all 'helm-only t)
+(helm-make-command-from-action helm-el-run-package-upgrade-all
+    "Upgrade all packages from helm elisp packages."
+  'helm-el-package-upgrade-all-action)
 
 (defun helm-el-package--transformer (candidates _source)
   (cl-loop for c in candidates
@@ -460,11 +450,9 @@ See `package-autoremove'."
     (package-install
      (cadr (assq name package-archive-contents)) t)))
 
-(defun helm-el-run-package-reinstall ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-el-package-reinstall)))
-(put 'helm-el-run-package-reinstall 'helm-only t)
+(helm-make-command-from-action helm-el-run-package-reinstall
+    "Reinstall package from helm elisp packages."
+  'helm-el-package-reinstall)
 
 ;;;###autoload
 (defun helm-list-elisp-packages (arg)
diff --git a/helm-grep.el b/helm-grep.el
index 71b6bb5aaf..12c78f4900 100644
--- a/helm-grep.el
+++ b/helm-grep.el
@@ -831,33 +831,21 @@ If N is positive go forward otherwise go backward."
   (with-helm-window
     (helm-goto-next-or-prec-file 1)))
 
-(defun helm-grep-run-default-action ()
+(helm-make-command-from-action helm-grep-run-default-action
   "Run grep default action from `helm-do-grep-1'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-grep-action)))
-(put 'helm-grep-run-default-action 'helm-only t)
+  'helm-grep-action)
 
-(defun helm-grep-run-other-window-action ()
+(helm-make-command-from-action helm-grep-run-other-window-action
   "Run grep goto other window action from `helm-do-grep-1'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-grep-other-window)))
-(put 'helm-grep-run-other-window-action 'helm-only t)
+  'helm-grep-other-window)
 
-(defun helm-grep-run-other-frame-action ()
+(helm-make-command-from-action helm-grep-run-other-frame-action
   "Run grep goto other frame action from `helm-do-grep-1'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-grep-other-frame)))
-(put 'helm-grep-run-other-frame-action 'helm-only t)
+  'helm-grep-other-frame)
 
-(defun helm-grep-run-save-buffer ()
+(helm-make-command-from-action helm-grep-run-save-buffer
   "Run grep save results action from `helm-do-grep-1'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-grep-save-results)))
-(put 'helm-grep-run-save-buffer 'helm-only t)
+  'helm-grep-save-results)
 
 (defun helm-grep-quit-an-find-file-fn (source)
   (let* ((sel (helm-get-selection nil nil source))
diff --git a/helm-occur.el b/helm-occur.el
index ad269ded43..36bf9688de 100644
--- a/helm-occur.el
+++ b/helm-occur.el
@@ -415,32 +415,21 @@ Same as `helm-occur-goto-line' but go in new frame."
   (helm-occur-action
    candidate 'buffer-other-frame))
 
-(defun helm-occur-run-goto-line-ow ()
+(helm-make-command-from-action helm-occur-run-goto-line-ow
   "Run goto line other window action from `helm-occur'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-occur-goto-line-ow)))
-(put 'helm-occur-run-goto-line-ow 'helm-only t)
+  'helm-occur-goto-line-ow)
 
-(defun helm-occur-run-goto-line-of ()
+(helm-make-command-from-action helm-occur-run-goto-line-of
   "Run goto line new frame action from `helm-occur'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-occur-goto-line-of)))
-(put 'helm-occur-run-goto-line-of 'helm-only t)
+  'helm-occur-goto-line-of)
 
-(defun helm-occur-run-default-action ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-occur-goto-line)))
-(put 'helm-occur-run-default-action 'helm-only t)
+(helm-make-command-from-action helm-occur-run-default-action
+    "Goto matching line from helm-occur buffer."
+    'helm-occur-goto-line)
 
-(defun helm-occur-run-save-buffer ()
+(helm-make-command-from-action helm-occur-run-save-buffer
   "Run moccur save results action from `helm-moccur'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-occur-save-results)))
-(put 'helm-moccur-run-save-buffer 'helm-only t)
+  'helm-occur-save-results)
 
 (defun helm-occur-right ()
   "`helm-occur' action for right arrow.
diff --git a/helm-ring.el b/helm-ring.el
index c9c50c93e5..4723618fe6 100644
--- a/helm-ring.el
+++ b/helm-ring.el
@@ -222,11 +222,9 @@ yanked string."
      (list (current-buffer))
      (regexp-quote (substring-no-properties str)))))
 
-(defun helm-kill-ring-run-search-from-string ()
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-kill-ring-search-from-string)))
-(put 'helm-kill-ring-run-search-from-string 'helm-only t)
+(helm-make-command-from-action helm-kill-ring-run-search-from-string
+    "Run helm-occur from kill ring."
+  'helm-kill-ring-search-from-string)
 
 (defun helm-kill-ring-action-delete (_candidate)
   "Delete marked candidates from `kill-ring'."
@@ -247,22 +245,13 @@ yanked string."
             helm-visible-mark-overlays nil))
     (helm-force-update (helm-aif (helm-get-selection nil t) (regexp-quote 
it)))))
 
-(defun helm-kill-ring-run-persistent-delete ()
+(helm-make-persistent-command-from-action helm-kill-ring-run-persistent-delete
   "Delete current candidate without quitting."
-  (interactive)
-  (with-helm-alive-p
-    (helm-set-attr 'quick-delete '(helm-kill-ring-persistent-delete . 
never-split))
-    (helm-execute-persistent-action 'quick-delete)))
-(put 'helm-kill-ring-run-persistent-delete 'helm-only t)
+  'quick-delete 'helm-kill-ring-persistent-delete)
 
-(defun helm-kill-ring-delete ()
-  "Delete marked candidates from `kill-ring'.
-
-This is a command for `helm-kill-ring-map'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action 'helm-kill-ring-action-delete)))
-(put 'helm-kill-ring-delete 'helm-only t)
+(helm-make-command-from-action helm-kill-ring-delete
+  "Delete marked candidates from `kill-ring'."
+  'helm-kill-ring-action-delete)
 
 
 ;;;; <Mark ring>
diff --git a/helm-tags.el b/helm-tags.el
index d716fda5f7..6faf33e95f 100644
--- a/helm-tags.el
+++ b/helm-tags.el
@@ -73,23 +73,25 @@ one match."
 ;;; Etags
 ;;
 ;;
-(defun helm-etags-run-switch-other-window ()
+(defun helm-etags-find-file (candidate)
+  "Find file CANDIDATE from helm etags buffer."
+  (helm-etags-action-goto 'find-file candidate))
+
+(defun helm-etags-find-file-other-window (candidate)
+  "Find file other window from helm etags buffer."
+  (helm-etags-action-goto 'find-file-other-window candidate))
+
+(defun helm-etags-find-file-other-frame (candidate)
+  "Find file other frame from helm etags buffer."
+  (helm-etags-action-goto 'find-file-other-frame candidate))
+
+(helm-make-command-from-action helm-etags-run-switch-other-window
   "Run switch to other window action from `helm-source-etags-select'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action
-     (lambda (c)
-       (helm-etags-action-goto 'find-file-other-window c)))))
-(put 'helm-etags-run-switch-other-window 'helm-only t)
-
-(defun helm-etags-run-switch-other-frame ()
+  'helm-etags-find-file-other-window)
+
+(helm-make-command-from-action helm-etags-run-switch-other-frame
   "Run switch to other frame action from `helm-source-etags-select'."
-  (interactive)
-  (with-helm-alive-p
-    (helm-exit-and-execute-action
-     (lambda (c)
-       (helm-etags-action-goto 'find-file-other-frame c)))))
-(put 'helm-etags-run-switch-other-frame 'helm-only t)
+  'helm-etags-find-file-other-frame)
 
 (defvar helm-etags-map
   (let ((map (make-sparse-keymap)))
@@ -226,16 +228,9 @@ If there is no entry in cache, create one."
     :fuzzy-match helm-etags-fuzzy-match
     :help-message 'helm-etags-help-message
     :keymap helm-etags-map
-    :action '(("Go to tag" . (lambda (c)
-                               (helm-etags-action-goto 'find-file c)))
-              ("Go to tag in other window" . (lambda (c)
-                                               (helm-etags-action-goto
-                                                'find-file-other-window
-                                                c)))
-              ("Go to tag in other frame" . (lambda (c)
-                                              (helm-etags-action-goto
-                                               'find-file-other-frame
-                                               c))))
+    :action '(("Go to tag" . helm-etags-find-file)
+              ("Go to tag in other window" . helm-etags-find-file-other-window)
+              ("Go to tag in other frame" . helm-etags-find-file-other-frame))
     :group 'helm-tags
     :persistent-help "Go to line"
     :persistent-action (lambda (candidate)



reply via email to

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