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

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

[elpa] externals/ivy-hydra 1ad457d 007/395: ivy.el (ivy-read-action-func


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 1ad457d 007/395: ivy.el (ivy-read-action-function): Fix type
Date: Thu, 25 Feb 2021 08:31:19 -0500 (EST)

branch: externals/ivy-hydra
commit 1ad457d8e76c431783d2efb866ef51b8c14e7c82
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    ivy.el (ivy-read-action-function): Fix type
    
    * ivy.el (ivy-dispatching-done): Bind `ivy-exit' so that
      `ivy-hydra-read-action' knows to call `ivy-done'.
    
    * ivy-hydra.el (ivy-hydra-read-action): Rename from 
`ivy-dispatching-done-hydra'.
    
    Fixes #2284
---
 ivy-hydra.el | 16 ++++++++--------
 ivy.el       |  7 ++++---
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/ivy-hydra.el b/ivy-hydra.el
index ce31f2b..1dd039d 100644
--- a/ivy-hydra.el
+++ b/ivy-hydra.el
@@ -62,7 +62,7 @@ _h_ ^+^ _l_ | _d_one      ^ ^  | _o_ops   | _M_: matcher 
%-5s(ivy--matcher-desc)
   ("t" ivy-toggle-marks)
   ;; actions
   ("o" keyboard-escape-quit :exit t)
-  ("r" ivy-dispatching-done-hydra :exit t)
+  ("r" ivy-dispatching-done :exit t)
   ("C-g" keyboard-escape-quit :exit t)
   ("i" nil)
   ("C-o" nil)
@@ -94,13 +94,12 @@ _h_ ^+^ _l_ | _d_one      ^ ^  | _o_ops   | _M_: matcher 
%-5s(ivy--matcher-desc)
 
 (defvar ivy-dispatching-done-hydra-exit-keys '(("M-o" nil "back")
                                                ("C-g" nil))
-  "Keys that can be used to exit `ivy-dispatching-done-hydra'.")
+  "Keys that can be used to exit `ivy-hydra-read-action'.")
 
-(defun ivy-dispatching-done-hydra ()
+(defun ivy-hydra-read-action (actions)
   "Select one of the available actions and call `ivy-done'."
   (interactive)
-  (let* ((actions (ivy-state-action ivy-last))
-         (extra-actions ivy-dispatching-done-hydra-exit-keys)
+  (let* ((extra-actions ivy-dispatching-done-hydra-exit-keys)
          (doc (concat "action: "
                       (mapconcat
                        (lambda (x) (format "[%s] %s" (nth 0 x) (nth 2 x)))
@@ -121,12 +120,13 @@ _h_ ^+^ _l_ | _d_one      ^ ^  | _o_ops   | _M_: matcher 
%-5s(ivy--matcher-desc)
                        (list (nth 0 x)
                              `(progn
                                 (setcar (ivy-state-action ivy-last) ,(cl-incf 
i))
-                                (ivy-done))
+                                ,(when (eq ivy-exit 'ivy-dispatching-done)
+                                   '(ivy-done)))
                              (nth 2 x)))
                      (cdr actions))
-           ,@extra-actions))))))
+           ,@extra-actions)))
+      nil)))
 
-(setq ivy-read-action-function (lambda (_) (ivy-dispatching-done-hydra)))
 
 (provide 'ivy-hydra)
 
diff --git a/ivy.el b/ivy.el
index 1c733dd..3bed34f 100644
--- a/ivy.el
+++ b/ivy.el
@@ -868,7 +868,7 @@ key (a string), cmd and doc (a string)."
   :type '(radio
           (function-item ivy-read-action-by-key)
           (function-item ivy-read-action-ivy)
-          (function-item ivy-read-action-hydra)))
+          (function-item ivy-hydra-read-action)))
 
 (defun ivy-read-action ()
   "Change the action to one of the available ones.
@@ -925,8 +925,9 @@ selection, non-nil otherwise."
 (defun ivy-dispatching-done ()
   "Select one of the available actions and call `ivy-done'."
   (interactive)
-  (when (ivy-read-action)
-    (ivy-done))
+  (let ((ivy-exit 'ivy-dispatching-done))
+    (when (ivy-read-action)
+      (ivy-done)))
   (ivy-shrink-after-dispatching))
 
 (defun ivy-dispatching-call ()



reply via email to

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