branch: master
commit 8875bf1b16c2f74fa3855d9ec8eddfe49edbb5c4
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
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