]> code.delx.au - gnu-emacs-elpa/commitdiff
Merge commit 'fb864353cd8dc91591942f398ef971ba7714b50f' from hydra
authorOleh Krehel <ohwoeowho@gmail.com>
Thu, 16 Apr 2015 13:08:02 +0000 (15:08 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Thu, 16 Apr 2015 13:08:02 +0000 (15:08 +0200)
1  2 
packages/hydra/Makefile
packages/hydra/hydra-init.el
packages/hydra/hydra-test.el
packages/hydra/hydra.el

diff --combined packages/hydra/Makefile
index 43bcb5a28382f5ea6a4b3a3e5125c65de1d1274c,dd3a762e6c68fc39fbf47bcf51770f559fdd05e3..dd3a762e6c68fc39fbf47bcf51770f559fdd05e3
@@@ -11,9 -11,12 +11,12 @@@ test
        @echo "Using $(shell which $(emacs))..."
        $(emacs) -batch $(LOAD) -f ert-run-tests-batch-and-exit
  
compile:
run:
        $(emacs) -q $(LOAD) -l hydra-init.el
        make clean
  
+ compile:
+       $(emacs) -batch $(LOAD) -l hydra-init.el
  clean:
        rm -f *.elc
index 80b4159ed6192dae3b41a8218f4d1a2dd082daa1,881ceb68e4e96212c4dc29ff70d224147d485e5b..881ceb68e4e96212c4dc29ff70d224147d485e5b
@@@ -24,6 -24,4 +24,4 @@@
  (setq hydra-examples-verbatim t)
  (require 'hydra-examples)
  (require 'hydra-test)
- (mapc #'byte-compile-file '("hydra.el"))
- (switch-to-buffer "*Compile-Log*")
- (ert t)
+ (mapc #'byte-compile-file '("hydra.el" "hydra-examples.el" "hydra-ox.el" "hydra-test.el" "lv.el"))
index 15eabcfdb3690118a575a743d5d59a93ba8fe76d,ea416af78e59801597fb3a13219b47d8a0331d72..9385ee6c5003a8c76059f4423b514cfe9bf6ef01
@@@ -25,7 -25,6 +25,7 @@@
  ;;; Code:
  
  (require 'ert)
 +(require 'hydra)
  (message "Emacs version: %s" emacs-version)
  
  (ert-deftest hydra-red-error ()
            "rep"
            :bind nil
            :exit nil))))
+       (set
+        (defvar hydra-error/hint nil
+          "Dynamic hint for hydra-error.")
+        (quote
+         (format
+          #("error: [h]: first, [j]: next, [k]: prev, [SPC]: rep."
+            8 9 (face hydra-face-red)
+            20 21 (face hydra-face-red)
+            31 32 (face hydra-face-red)
+            42 45 (face hydra-face-red)))))
        (defun hydra-error/first-error nil
          "Create a hydra with a \"M-g\" body and the heads:
  
@@@ -215,16 -224,6 +225,6 @@@ Call the head: `previous-error'.
        (define-key global-map [134217831 107]
         (function
          hydra-error/previous-error))
-       (set
-        (defvar hydra-error/hint nil
-          "Dynamic hint for hydra-error.")
-        (quote
-         (format
-          #("error: [h]: first, [j]: next, [k]: prev, [SPC]: rep."
-            8 9 (face hydra-face-red)
-            20 21 (face hydra-face-red)
-            31 32 (face hydra-face-red)
-            42 45 (face hydra-face-red)))))
        (defun hydra-error/body nil
          "Create a hydra with a \"M-g\" body and the heads:
  
@@@ -313,6 -312,16 +313,16 @@@ The body can be accessed via `hydra-err
            "abbrev"
            :exit t)
           ("q" nil "cancel" :exit t))))
+       (set
+        (defvar hydra-toggle/hint nil
+          "Dynamic hint for hydra-toggle.")
+        (quote
+         (format
+          #("toggle: [t]: truncate, [f]: fill, [a]: abbrev, [q]: cancel."
+            9 10 (face hydra-face-blue)
+            24 25 (face hydra-face-blue)
+            35 36 (face hydra-face-blue)
+            48 49 (face hydra-face-blue)))))
        (defun hydra-toggle/toggle-truncate-lines-and-exit nil
          "Create a hydra with no body and the heads:
  
@@@ -385,16 -394,6 +395,6 @@@ Call the head: `nil'.
          (interactive)
          (hydra-default-pre)
          (hydra-keyboard-quit))
-       (set
-        (defvar hydra-toggle/hint nil
-          "Dynamic hint for hydra-toggle.")
-        (quote
-         (format
-          #("toggle: [t]: truncate, [f]: fill, [a]: abbrev, [q]: cancel."
-            9 10 (face hydra-face-blue)
-            24 25 (face hydra-face-blue)
-            35 36 (face hydra-face-blue)
-            48 49 (face hydra-face-blue)))))
        (defun hydra-toggle/body nil
          "Create a hydra with no body and the heads:
  
@@@ -479,6 -478,15 +479,15 @@@ The body can be accessed via `hydra-tog
            ""
            :exit nil)
           ("q" nil "quit" :exit t))))
+       (set
+        (defvar hydra-vi/hint nil
+          "Dynamic hint for hydra-vi.")
+        (quote
+         (format
+          #("vi: j, k, [q]: quit."
+            4 5 (face hydra-face-amaranth)
+            7 8 (face hydra-face-amaranth)
+            11 12 (face hydra-face-teal)))))
        (defun hydra-vi/next-line nil
          "Create a hydra with no body and the heads:
  
@@@ -563,15 -571,6 +572,6 @@@ Call the head: `nil'.
          (hydra-default-pre)
          (set-cursor-color "#e52b50")
          (hydra-keyboard-quit))
-       (set
-        (defvar hydra-vi/hint nil
-          "Dynamic hint for hydra-vi.")
-        (quote
-         (format
-          #("vi: j, k, [q]: quit."
-            4 5 (face hydra-face-amaranth)
-            7 8 (face hydra-face-amaranth)
-            11 12 (face hydra-face-teal)))))
        (defun hydra-vi/body nil
          "Create a hydra with no body and the heads:
  
@@@ -656,6 -655,14 +656,14 @@@ The body can be accessed via `hydra-vi/
            nil
            :bind nil
            :exit t))))
+       (set
+        (defvar hydra-zoom/hint nil
+          "Dynamic hint for hydra-zoom.")
+        (quote
+         (format
+          #("zoom: [r 0]: reset."
+            7 8 (face hydra-face-red)
+            9 10 (face hydra-face-blue)))))
        (defun hydra-zoom/lambda-r nil
          "Create a hydra with no body and the heads:
  
@@@ -709,14 -716,6 +717,6 @@@ Call the head: `(text-scale-set 0)'.
            (lambda nil
             (interactive)
             (text-scale-set 0)))))
-       (set
-        (defvar hydra-zoom/hint nil
-          "Dynamic hint for hydra-zoom.")
-        (quote
-         (format
-          #("zoom: [r 0]: reset."
-            7 8 (face hydra-face-red)
-            9 10 (face hydra-face-blue)))))
        (defun hydra-zoom/body nil
          "Create a hydra with no body and the heads:
  
@@@ -801,6 -800,14 +801,14 @@@ The body can be accessed via `hydra-zoo
            nil
            :bind nil
            :exit nil))))
+       (set
+        (defvar hydra-zoom/hint nil
+          "Dynamic hint for hydra-zoom.")
+        (quote
+         (format
+          #("zoom: [r 0]: reset."
+            7 8 (face hydra-face-red)
+            9 10 (face hydra-face-blue)))))
        (defun hydra-zoom/lambda-r nil
          "Create a hydra with no body and the heads:
  
@@@ -854,14 -861,6 +862,6 @@@ Call the head: `(text-scale-set 0)'.
            (lambda nil
             (interactive)
             (text-scale-set 0)))))
-       (set
-        (defvar hydra-zoom/hint nil
-          "Dynamic hint for hydra-zoom.")
-        (quote
-         (format
-          #("zoom: [r 0]: reset."
-            7 8 (face hydra-face-red)
-            9 10 (face hydra-face-blue)))))
        (defun hydra-zoom/body nil
          "Create a hydra with no body and the heads:
  
diff --combined packages/hydra/hydra.el
index 27d48d50af9b9ecfd1080b45c5c5682f85536677,86f488327d2bc49cc6f19f3fa52ed9d778661a30..86f488327d2bc49cc6f19f3fa52ed9d778661a30
@@@ -5,7 -5,7 +5,7 @@@
  ;; Author: Oleh Krehel <ohwoeowho@gmail.com>
  ;; Maintainer: Oleh Krehel <ohwoeowho@gmail.com>
  ;; URL: https://github.com/abo-abo/hydra
- ;; Version: 0.13.0
+ ;; Version: 0.13.1
  ;; Keywords: bindings
  ;; Package-Requires: ((cl-lib "0.5"))
  
@@@ -442,7 -442,7 +442,7 @@@ HEAD's binding is returned as a string 
                    (teal 'hydra-face-teal)
                    (t (error "Unknown color for %S" head))))))
  
- (defun hydra-fontify-head-greyscale (head body)
+ (defun hydra-fontify-head-greyscale (head _body)
    "Produce a pretty string from HEAD and BODY.
  HEAD's binding is returned as a string wrapped with [] or {}."
    (format
@@@ -548,7 -548,7 +548,7 @@@ HEAD is one of the HEADS passed to `def
  BODY-PRE is added to the start of the wrapper.
  BODY-BEFORE-EXIT will be called before the hydra quits.
  BODY-AFTER-EXIT is added to the end of the wrapper."
-   (let ((name (hydra--head-name head name body))
+   (let ((name (hydra--head-name head name))
          (cmd (when (car head)
                 (hydra--make-callable
                  (cadr head))))
    `(when (and ,sym (symbolp ,sym))
       (setq ,sym `(funcall #',,sym))))
  
- (defun hydra--head-name (h name body)
-   "Return the symbol for head H of hydra with NAME and BODY."
+ (defun hydra--head-name (h name)
+   "Return the symbol for head H of hydra with NAME."
    (let ((str (format "%S/%s" name
                       (if (symbolp (cadr h))
                           (cadr h)
@@@ -868,7 -868,7 +868,7 @@@ result of `defhydra'.
                                          (if (eq h-exit 'default)
                                              body-exit
                                            h-exit))))))))))
-           (plist-put (cl-cdddr h) :cmd-name (hydra--head-name h name body))
+           (plist-put (cl-cdddr h) :cmd-name (hydra--head-name h name))
            (when (null (cadr h)) (plist-put (cl-cdddr h) :exit t)))
          (let ((doc (hydra--doc body-key body-name heads))
                (heads-nodup (hydra--delete-duplicates heads)))
                                  (cl-remf (cl-cdddr j) :cmd-name)
                                  j))
                              heads))
+              (set
+               (defvar ,(intern (format "%S/hint" name)) nil
+                 ,(format "Dynamic hint for %S." name))
+               ',(hydra--format name body docstring heads))
               ;; create defuns
               ,@(mapcar
                  (lambda (head)
                                      (t
                                       (error "Invalid :bind property `%S' for head %S" bind head)))))))
                        heads))
-              (set
-               (defvar ,(intern (format "%S/hint" name)) nil
-                 ,(format "Dynamic hint for %S." name))
-               ',(hydra--format name body docstring heads))
               ,(hydra--make-defun
                 name body doc '(nil body)
                 keymap-name