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

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

[elpa] master 8875bf1 28/45: Make digit and negative arguments work in 2


From: Oleh Krehel
Subject: [elpa] master 8875bf1 28/45: Make digit and negative arguments work in 24.3
Date: Thu, 16 Apr 2015 12:45:51 +0000

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

    Make digit and negative arguments work in 24.3
    
    * hydra.el (hydra--digit-argument): Update.
    (hydra--negative-argument): Update.
    
    Just flatten these two functions to their 25.2 bodies, and don't call
    the `set-transient-map' variants, since the map remains anyway because
    of `hydra-base-map'.
---
 hydra.el |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/hydra.el b/hydra.el
index 0d219e3..15ef310 100644
--- a/hydra.el
+++ b/hydra.el
@@ -253,17 +253,28 @@ Vanquishable only through a blue head.")
 (defun hydra--digit-argument (arg)
   "Forward to (`digit-argument' ARG)."
   (interactive "P")
-  (let ((universal-argument-map
-         (if (fboundp 'universal-argument--mode)
-             hydra-curr-map
-           universal-argument-map)))
-    (digit-argument arg)))
+  (let* ((char (if (integerp last-command-event)
+                   last-command-event
+                 (get last-command-event 'ascii-character)))
+         (digit (- (logand char ?\177) ?0)))
+    (setq prefix-arg (cond ((integerp arg)
+                            (+ (* arg 10)
+                               (if (< arg 0)
+                                   (- digit)
+                                 digit)))
+                           ((eq arg '-)
+                            (if (zerop digit)
+                                '-
+                              (- digit)))
+                           (t
+                            digit)))))
 
 (defun hydra--negative-argument (arg)
   "Forward to (`negative-argument' ARG)."
   (interactive "P")
-  (let ((universal-argument-map hydra-curr-map))
-    (negative-argument arg)))
+  (setq prefix-arg (cond ((integerp arg) (- arg))
+                         ((eq arg '-) nil)
+                         (t '-))))
 
 ;;* Repeat
 (defvar hydra-repeat--prefix-arg nil



reply via email to

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