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

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

[elpa] master fb86435 1/2: Declare the hint early to avoid compile warni


From: Oleh Krehel
Subject: [elpa] master fb86435 1/2: Declare the hint early to avoid compile warnings
Date: Thu, 16 Apr 2015 13:14:01 +0000

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

    Declare the hint early to avoid compile warnings
    
    * hydra.el (hydra-fontify-head-greyscale): Update unused arg.
    (hydra--make-defun): Update.
    (hydra--head-name): Take one less arg.
    (defhydra): Update hint position.
    
    * hydra-init.el: Byte compile more stuff.
    
    * hydra-test.el: Update tests.
    
    * Makefile: Rename compile target to "run", update "compile".
---
 Makefile      |    5 ++-
 hydra-init.el |    4 +--
 hydra-test.el |   90 ++++++++++++++++++++++++++++----------------------------
 hydra.el      |   20 ++++++------
 4 files changed, 60 insertions(+), 59 deletions(-)

diff --git a/Makefile b/Makefile
index 43bcb5a..dd3a762 100644
--- a/Makefile
+++ b/Makefile
@@ -11,9 +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
diff --git a/hydra-init.el b/hydra-init.el
index 80b4159..881ceb6 100644
--- a/hydra-init.el
+++ b/hydra-init.el
@@ -24,6 +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"))
diff --git a/hydra-test.el b/hydra-test.el
index d9adba6..ea416af 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -91,6 +91,16 @@
           "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:
 
@@ -214,16 +224,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:
 
@@ -312,6 +312,16 @@ The body can be accessed via `hydra-error/body'."
           "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:
 
@@ -384,16 +394,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:
 
@@ -478,6 +478,15 @@ The body can be accessed via `hydra-toggle/body'."
           ""
           :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:
 
@@ -562,15 +571,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:
 
@@ -655,6 +655,14 @@ The body can be accessed via `hydra-vi/body'."
           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:
 
@@ -708,14 +716,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:
 
@@ -800,6 +800,14 @@ The body can be accessed via `hydra-zoom/body'."
           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:
 
@@ -853,14 +861,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 --git a/hydra.el b/hydra.el
index 27d48d5..86f4883 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.13.0
+;; Version: 0.13.1
 ;; Keywords: bindings
 ;; Package-Requires: ((cl-lib "0.5"))
 
@@ -442,7 +442,7 @@ HEAD's binding is returned as a string with a colored face."
                   (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 @@ HEAD is one of the HEADS passed to `defhydra'.
 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))))
@@ -604,8 +604,8 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
   `(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 @@ 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)))
@@ -904,6 +904,10 @@ result of `defhydra'."
                                 (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)
@@ -941,10 +945,6 @@ result of `defhydra'."
                                     (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



reply via email to

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