branch: externals/ivy-hydra
commit 554c1787c201fbcdf08fca533f9ba47a042c16de
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    ivy.el (ivy-set-actions): Allow to override the default action using "o"
    
    Fixes #2468
---
 ivy.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/ivy.el b/ivy.el
index 3fc05d7..9b2fd69 100644
--- a/ivy.el
+++ b/ivy.el
@@ -321,11 +321,16 @@ ACTIONS that have the same key."
 
 (defun ivy--compute-extra-actions (action caller)
   "Add extra actions to ACTION based on CALLER."
-  (let ((extra-actions (cl-delete-duplicates
-                        (append (plist-get ivy--actions-list t)
-                                (plist-get ivy--actions-list this-command)
-                                (plist-get ivy--actions-list caller))
-                        :key #'car :test #'equal)))
+  (let* ((extra-actions (cl-delete-duplicates
+                         (append (plist-get ivy--actions-list t)
+                                 (plist-get ivy--actions-list this-command)
+                                 (plist-get ivy--actions-list caller))
+                         :key #'car :test #'equal))
+         (override-default (assoc "o" extra-actions)))
+    (when override-default
+      (setq action (cadr override-default))
+      (setq extra-actions
+            (assoc-delete-all "o" extra-actions)))
     (if extra-actions
         (cond ((functionp action)
                `(1

Reply via email to