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

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

[elpa] master 7f5b268 311/348: ivy-hydra.el: Add an alternative "M-o" us


From: Oleh Krehel
Subject: [elpa] master 7f5b268 311/348: ivy-hydra.el: Add an alternative "M-o" using hydra
Date: Sat, 8 Apr 2017 11:04:21 -0400 (EDT)

branch: master
commit 7f5b2685fb01d49ee88ec6c4fc84f659930891b2
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy-hydra.el: Add an alternative "M-o" using hydra
---
 ivy-hydra.el | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/ivy-hydra.el b/ivy-hydra.el
index 5b69d4f..0c53499 100644
--- a/ivy-hydra.el
+++ b/ivy-hydra.el
@@ -77,6 +77,27 @@ _h_ ^+^ _l_ | _d_one      ^ ^  | _o_ops   | _m_: matcher 
%-5s(ivy--matcher-desc)
         (lambda (_) (find-function 'hydra-ivy/body)))
        :exit t))
 
+(defun ivy-dispatching-done-hydra ()
+  "Select one of the available actions and call `ivy-done'."
+  (interactive)
+  (let ((actions (ivy-state-action ivy-last)))
+    (if (null (ivy--actionp actions))
+        (ivy-done)
+      (funcall
+       (eval
+        `(defhydra ivy-read-action (:color teal)
+           "action"
+           ,@(mapcar (lambda (x)
+                       (list (nth 0 x)
+                             `(progn
+                                (ivy-set-action ',(nth 1 x))
+                                (ivy-done))
+                             (nth 2 x)))
+                     (cdr actions))
+           ("M-o" nil "back")))))))
+
+(define-key ivy-mode-map (kbd "M-o") 'ivy-dispatching-done-hydra)
+
 (provide 'ivy-hydra)
 
 ;;; ivy-hydra.el ends here



reply via email to

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