Skip to content

Commit 8875bf1

Browse files
committed
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'.
1 parent acdec5b commit 8875bf1

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

hydra.el

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,28 @@ Vanquishable only through a blue head.")
253253
(defun hydra--digit-argument (arg)
254254
"Forward to (`digit-argument' ARG)."
255255
(interactive "P")
256-
(let ((universal-argument-map
257-
(if (fboundp 'universal-argument--mode)
258-
hydra-curr-map
259-
universal-argument-map)))
260-
(digit-argument arg)))
256+
(let* ((char (if (integerp last-command-event)
257+
last-command-event
258+
(get last-command-event 'ascii-character)))
259+
(digit (- (logand char ?\177) ?0)))
260+
(setq prefix-arg (cond ((integerp arg)
261+
(+ (* arg 10)
262+
(if (< arg 0)
263+
(- digit)
264+
digit)))
265+
((eq arg '-)
266+
(if (zerop digit)
267+
'-
268+
(- digit)))
269+
(t
270+
digit)))))
261271

262272
(defun hydra--negative-argument (arg)
263273
"Forward to (`negative-argument' ARG)."
264274
(interactive "P")
265-
(let ((universal-argument-map hydra-curr-map))
266-
(negative-argument arg)))
275+
(setq prefix-arg (cond ((integerp arg) (- arg))
276+
((eq arg '-) nil)
277+
(t '-))))
267278

268279
;;* Repeat
269280
(defvar hydra-repeat--prefix-arg nil

0 commit comments

Comments
 (0)