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

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

[elpa] master b359db6 1/2: hydra.el (defhydra): fix a bug for old Emacs


From: Oleh Krehel
Subject: [elpa] master b359db6 1/2: hydra.el (defhydra): fix a bug for old Emacs versions
Date: Fri, 30 Jan 2015 20:02:10 +0000

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

    hydra.el (defhydra): fix a bug for old Emacs versions
    
    re #10
---
 hydra-test.el |    8 +++++---
 hydra.el      |   19 +++++++++++++++----
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 8ee56eb..d1cb902 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -57,7 +57,7 @@ Call the head: `next-error'."
                  (107 . hydra-error/previous-error)
                  (106 . hydra-error/next-error)
                  (104 . hydra-error/first-error)) t)))
-      
+
       (defun hydra-error/previous-error ()
         "Create a hydra with a \"M-g\" body and the heads:
 
@@ -81,13 +81,13 @@ Call the head: `previous-error'."
                  (107 . hydra-error/previous-error)
                  (106 . hydra-error/next-error)
                  (104 . hydra-error/first-error)) t)))
-      
+
       (unless (keymapp (lookup-key global-map (kbd "M-g")))
         (define-key global-map (kbd "M-g") nil))
       (define-key global-map [134217831 104] #'hydra-error/first-error)
       (define-key global-map [134217831 106] #'hydra-error/next-error)
       (define-key global-map [134217831 107] #'hydra-error/previous-error)
-      
+
       (defun hydra-error/body ()
         "Create a hydra with a \"M-g\" body and the heads:
 
@@ -108,3 +108,5 @@ The body can be accessed via `hydra-error/body'."
                  (107 . hydra-error/previous-error)
                  (106 . hydra-error/next-error)
                  (104 . hydra-error/first-error)) t)))))))
+
+(provide 'hydra-test)
diff --git a/hydra.el b/hydra.el
index b7ca064..e6950eb 100644
--- a/hydra.el
+++ b/hydra.el
@@ -5,7 +5,7 @@
 ;; Author: Oleh Krehel <address@hidden>
 ;; Maintainer: Oleh Krehel <address@hidden>
 ;; URL: https://github.com/abo-abo/hydra
-;; Version: 0.4.0
+;; Version: 0.4.1
 ;; Keywords: bindings
 ;; Package-Requires: ((cl-lib "0.5"))
 
@@ -51,6 +51,14 @@
 ;;
 ;; The third element of each list is the optional doc string that will
 ;; be displayed in the echo area when `hydra-is-helpful' is t.
+;;
+;; It's better to take the examples simply as templates and use
+;; `defhydra' instead of `hydra-create', since it's more flexible.
+;;
+;;     (defhydra hydra-zoom (global-map "<f2>")
+;;       "zoom"
+;;       ("g" text-scale-increase "in")
+;;       ("l" text-scale-decrease "out"))
 
 ;;; Code:
 (require 'cl-lib)
@@ -170,10 +178,13 @@ HEADS is a list of (KEY CMD &optional HINT)."
                ,(format "%s\n\nCall the head: `%S'." doc (cadr head))
                (interactive)
                ,@(if (null (cadr head))
-                     '((if (functionp hydra-last)
+                     `((if (functionp hydra-last)
                            (funcall hydra-last)
-                         (ignore-errors
-                           (funcall 'clear-temporary-overlay-map))))
+                         (while (and (consp (car emulation-mode-map-alists))
+                                     (consp (caar emulation-mode-map-alists))
+                                     (equal (cl-cdaar 
emulation-mode-map-alists) ',keymap))
+                           (setq emulation-mode-map-alists
+                                 (cdr emulation-mode-map-alists)))))
                      `((call-interactively #',(cadr head))
                        (when hydra-is-helpful
                          (message ,hint))



reply via email to

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