("k" previous-error "prev")
("SPC" hydra-repeat "rep" :bind nil)))
'(progn
- (set (defvar hydra-error/keymap nil "Keymap for hydra-error.")
- (quote (keymap (7 . hydra-keyboard-quit)
- (32 . hydra-repeat)
+ (set
+ (defvar hydra-error/keymap nil
+ "Keymap for hydra-error.")
+ (quote (keymap (32 . hydra-repeat)
(107 . hydra-error/previous-error)
(106 . hydra-error/next-error)
(104 . hydra-error/first-error)
- (switch-frame . hydra--handle-switch-frame)
+ (7 . hydra-keyboard-quit)
(kp-subtract . hydra--negative-argument)
(kp-9 . hydra--digit-argument)
(kp-8 . hydra--digit-argument)
(48 . hydra--digit-argument)
(45 . hydra--negative-argument)
(21 . hydra--universal-argument))))
- (defun hydra-error/first-error nil "Create a hydra with a \"M-g\" body and the heads:
+ (defun hydra-error/first-error nil
+ "Create a hydra with a \"M-g\" body and the heads:
\"h\": `first-error',
\"j\": `next-error',
The body can be accessed via `hydra-error/body'.
Call the head: `first-error'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
- (condition-case err (call-interactively (function first-error))
- ((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8))))
- (when hydra-is-helpful (hydra-error/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-error/keymap)
- t (lambda nil (hydra-keyboard-quit))))))
- (defun hydra-error/next-error nil "Create a hydra with a \"M-g\" body and the heads:
+ (interactive)
+ (hydra-default-pre)
+ (condition-case err
+ (call-interactively
+ (function first-error))
+ ((quit error)
+ (message "%S" err)
+ (unless hydra-lv (sit-for 0.8))))
+ (when hydra-is-helpful
+ (hydra-error/hint))
+ (hydra-set-transient-map
+ hydra-error/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ nil)
+ nil))
+ (defun hydra-error/next-error nil
+ "Create a hydra with a \"M-g\" body and the heads:
\"h\": `first-error',
\"j\": `next-error',
The body can be accessed via `hydra-error/body'.
Call the head: `next-error'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
- (condition-case err (call-interactively (function next-error))
- ((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8))))
- (when hydra-is-helpful (hydra-error/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-error/keymap)
- t (lambda nil (hydra-keyboard-quit))))))
- (defun hydra-error/previous-error nil "Create a hydra with a \"M-g\" body and the heads:
+ (interactive)
+ (hydra-default-pre)
+ (condition-case err
+ (call-interactively
+ (function next-error))
+ ((quit error)
+ (message "%S" err)
+ (unless hydra-lv (sit-for 0.8))))
+ (when hydra-is-helpful
+ (hydra-error/hint))
+ (hydra-set-transient-map
+ hydra-error/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ nil)
+ nil))
+ (defun hydra-error/previous-error nil
+ "Create a hydra with a \"M-g\" body and the heads:
\"h\": `first-error',
\"j\": `next-error',
The body can be accessed via `hydra-error/body'.
Call the head: `previous-error'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
- (condition-case err (call-interactively (function previous-error))
- ((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8))))
- (when hydra-is-helpful (hydra-error/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-error/keymap)
- t (lambda nil (hydra-keyboard-quit))))))
- (unless (keymapp (lookup-key global-map (kbd "M-g")))
+ (interactive)
+ (hydra-default-pre)
+ (condition-case err
+ (call-interactively
+ (function previous-error))
+ ((quit error)
+ (message "%S" err)
+ (unless hydra-lv (sit-for 0.8))))
+ (when hydra-is-helpful
+ (hydra-error/hint))
+ (hydra-set-transient-map
+ hydra-error/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ nil)
+ nil))
+ (unless (keymapp
+ (lookup-key
+ global-map
+ (kbd "M-g")))
(define-key global-map (kbd "M-g")
nil))
(define-key global-map [134217831 104]
- (function hydra-error/first-error))
+ (function
+ hydra-error/first-error))
(define-key global-map [134217831 106]
- (function hydra-error/next-error))
+ (function
+ hydra-error/next-error))
(define-key global-map [134217831 107]
- (function hydra-error/previous-error))
+ (function
+ hydra-error/previous-error))
(defun hydra-error/hint nil
- (if hydra-lv (lv-message (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))))
- (message (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:
+ (if hydra-lv
+ (lv-message
+ (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))))
+ (message
+ (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:
\"h\": `first-error',
\"j\": `next-error',
\"SPC\": `hydra-repeat'
The body can be accessed via `hydra-error/body'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
- (when hydra-is-helpful (hydra-error/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-error/keymap)
- t (lambda nil (hydra-keyboard-quit))))
- (setq prefix-arg current-prefix-arg)))))))
+ (interactive)
+ (hydra-default-pre)
+ (when hydra-is-helpful
+ (hydra-error/hint))
+ (hydra-set-transient-map
+ hydra-error/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ nil)
+ nil)
+ (setq prefix-arg
+ current-prefix-arg))))))
(ert-deftest hydra-blue-toggle ()
(should
("a" abbrev-mode "abbrev")
("q" nil "cancel")))
'(progn
- (set (defvar hydra-toggle/keymap nil "Keymap for hydra-toggle.")
- (quote (keymap (7 . hydra-keyboard-quit)
- (113 . hydra-toggle/nil)
+ (set
+ (defvar hydra-toggle/keymap nil
+ "Keymap for hydra-toggle.")
+ (quote (keymap (113 . hydra-toggle/nil)
(97 . hydra-toggle/abbrev-mode-and-exit)
(102 . hydra-toggle/auto-fill-mode-and-exit)
(116 . hydra-toggle/toggle-truncate-lines-and-exit)
- (switch-frame . hydra--handle-switch-frame)
+ (7 . hydra-keyboard-quit)
(kp-subtract . hydra--negative-argument)
(kp-9 . hydra--digit-argument)
(kp-8 . hydra--digit-argument)
(48 . hydra--digit-argument)
(45 . hydra--negative-argument)
(21 . hydra--universal-argument))))
- (defun hydra-toggle/toggle-truncate-lines-and-exit nil "Create a hydra with no body and the heads:
+ (defun hydra-toggle/toggle-truncate-lines-and-exit nil
+ "Create a hydra with no body and the heads:
\"t\": `toggle-truncate-lines',
\"f\": `auto-fill-mode',
The body can be accessed via `hydra-toggle/body'.
Call the head: `toggle-truncate-lines'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (hydra-keyboard-quit)
- (catch (quote hydra-disable)
- (call-interactively (function toggle-truncate-lines))))
- (defun hydra-toggle/auto-fill-mode-and-exit nil "Create a hydra with no body and the heads:
+ (interactive)
+ (hydra-default-pre)
+ (hydra-keyboard-quit)
+ (call-interactively
+ (function
+ toggle-truncate-lines))
+ nil)
+ (defun hydra-toggle/auto-fill-mode-and-exit nil
+ "Create a hydra with no body and the heads:
\"t\": `toggle-truncate-lines',
\"f\": `auto-fill-mode',
The body can be accessed via `hydra-toggle/body'.
Call the head: `auto-fill-mode'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (hydra-keyboard-quit)
- (catch (quote hydra-disable)
- (call-interactively (function auto-fill-mode))))
- (defun hydra-toggle/abbrev-mode-and-exit nil "Create a hydra with no body and the heads:
+ (interactive)
+ (hydra-default-pre)
+ (hydra-keyboard-quit)
+ (call-interactively
+ (function auto-fill-mode))
+ nil)
+ (defun hydra-toggle/abbrev-mode-and-exit nil
+ "Create a hydra with no body and the heads:
\"t\": `toggle-truncate-lines',
\"f\": `auto-fill-mode',
The body can be accessed via `hydra-toggle/body'.
Call the head: `abbrev-mode'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (hydra-keyboard-quit)
- (catch (quote hydra-disable)
- (call-interactively (function abbrev-mode))))
- (defun hydra-toggle/nil nil "Create a hydra with no body and the heads:
+ (interactive)
+ (hydra-default-pre)
+ (hydra-keyboard-quit)
+ (call-interactively
+ (function abbrev-mode))
+ nil)
+ (defun hydra-toggle/nil nil
+ "Create a hydra with no body and the heads:
\"t\": `toggle-truncate-lines',
\"f\": `auto-fill-mode',
The body can be accessed via `hydra-toggle/body'.
Call the head: `nil'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (hydra-keyboard-quit)
- (catch (quote hydra-disable)))
+ (interactive)
+ (hydra-default-pre)
+ (hydra-keyboard-quit)
+ nil
+ nil)
(defun hydra-toggle/hint nil
- (if hydra-lv (lv-message (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))))
- (message (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:
+ (if hydra-lv
+ (lv-message
+ (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))))
+ (message
+ (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:
\"t\": `toggle-truncate-lines',
\"f\": `auto-fill-mode',
\"q\": `nil'
The body can be accessed via `hydra-toggle/body'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
- (when hydra-is-helpful (hydra-toggle/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-toggle/keymap)
- t (lambda nil (hydra-keyboard-quit))))
- (setq prefix-arg current-prefix-arg)))))))
+ (interactive)
+ (hydra-default-pre)
+ (when hydra-is-helpful
+ (hydra-toggle/hint))
+ (hydra-set-transient-map
+ hydra-toggle/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ nil)
+ nil)
+ (setq prefix-arg
+ current-prefix-arg))))))
(ert-deftest hydra-amaranth-vi ()
(should
("k" previous-line)
("q" nil "quit")))
'(progn
- (set (defvar hydra-vi/keymap nil "Keymap for hydra-vi.")
- (quote (keymap (t lambda nil (interactive)
- (message "An amaranth Hydra can only exit through a blue head")
- (hydra-set-transient-map hydra-curr-map t)
- (when hydra-is-helpful (unless hydra-lv (sit-for 0.8))
- (hydra-vi/hint)))
- (113 . hydra-vi/nil)
+ (set
+ (defvar hydra-vi/keymap nil
+ "Keymap for hydra-vi.")
+ (quote (keymap (113 . hydra-vi/nil)
(107 . hydra-vi/previous-line)
(106 . hydra-vi/next-line)
(7 . hydra-vi/hydra-keyboard-quit-and-exit)
- (switch-frame . hydra--handle-switch-frame)
(kp-subtract . hydra--negative-argument)
(kp-9 . hydra--digit-argument)
(kp-8 . hydra--digit-argument)
(48 . hydra--digit-argument)
(45 . hydra--negative-argument)
(21 . hydra--universal-argument))))
- (defun hydra-vi/hydra-keyboard-quit-and-exit nil "Create a hydra with no body and the heads:
+ (defun hydra-vi/hydra-keyboard-quit-and-exit nil
+ "Create a hydra with no body and the heads:
\"\a\": `hydra-keyboard-quit',
\"j\": `next-line',
The body can be accessed via `hydra-vi/body'.
Call the head: `hydra-keyboard-quit'."
- (interactive)
- (hydra-default-pre)
- (set-cursor-color "#e52b50")
- (hydra-disable)
- (hydra-keyboard-quit)
- (catch (quote hydra-disable)
- (call-interactively (function hydra-keyboard-quit))
- (set-cursor-color "#ffffff")))
- (defun hydra-vi/next-line nil "Create a hydra with no body and the heads:
+ (interactive)
+ (hydra-default-pre)
+ (set-cursor-color "#e52b50")
+ (hydra-keyboard-quit)
+ (call-interactively
+ (function hydra-keyboard-quit))
+ (set-cursor-color "#ffffff"))
+ (defun hydra-vi/next-line nil
+ "Create a hydra with no body and the heads:
\"\a\": `hydra-keyboard-quit',
\"j\": `next-line',
The body can be accessed via `hydra-vi/body'.
Call the head: `next-line'."
- (interactive)
- (hydra-default-pre)
- (set-cursor-color "#e52b50")
- (hydra-disable)
- (catch (quote hydra-disable)
- (condition-case err (call-interactively (function next-line))
- ((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8))))
- (when hydra-is-helpful (hydra-vi/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-vi/keymap)
- t (lambda nil (hydra-keyboard-quit))))))
- (defun hydra-vi/previous-line nil "Create a hydra with no body and the heads:
+ (interactive)
+ (hydra-default-pre)
+ (set-cursor-color "#e52b50")
+ (condition-case err
+ (call-interactively
+ (function next-line))
+ ((quit error)
+ (message "%S" err)
+ (unless hydra-lv (sit-for 0.8))))
+ (when hydra-is-helpful
+ (hydra-vi/hint))
+ (hydra-set-transient-map
+ hydra-vi/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ (set-cursor-color "#ffffff"))
+ (quote warn)))
+ (defun hydra-vi/previous-line nil
+ "Create a hydra with no body and the heads:
\"\a\": `hydra-keyboard-quit',
\"j\": `next-line',
The body can be accessed via `hydra-vi/body'.
Call the head: `previous-line'."
- (interactive)
- (hydra-default-pre)
- (set-cursor-color "#e52b50")
- (hydra-disable)
- (catch (quote hydra-disable)
- (condition-case err (call-interactively (function previous-line))
- ((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8))))
- (when hydra-is-helpful (hydra-vi/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-vi/keymap)
- t (lambda nil (hydra-keyboard-quit))))))
- (defun hydra-vi/nil nil "Create a hydra with no body and the heads:
+ (interactive)
+ (hydra-default-pre)
+ (set-cursor-color "#e52b50")
+ (condition-case err
+ (call-interactively
+ (function previous-line))
+ ((quit error)
+ (message "%S" err)
+ (unless hydra-lv (sit-for 0.8))))
+ (when hydra-is-helpful
+ (hydra-vi/hint))
+ (hydra-set-transient-map
+ hydra-vi/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ (set-cursor-color "#ffffff"))
+ (quote warn)))
+ (defun hydra-vi/nil nil
+ "Create a hydra with no body and the heads:
\"\a\": `hydra-keyboard-quit',
\"j\": `next-line',
The body can be accessed via `hydra-vi/body'.
Call the head: `nil'."
- (interactive)
- (hydra-default-pre)
- (set-cursor-color "#e52b50")
- (hydra-disable)
- (hydra-keyboard-quit)
- (catch (quote hydra-disable)
- (set-cursor-color "#ffffff")))
+ (interactive)
+ (hydra-default-pre)
+ (set-cursor-color "#e52b50")
+ (hydra-keyboard-quit)
+ nil
+ (set-cursor-color "#ffffff"))
(defun hydra-vi/hint nil
- (if hydra-lv (lv-message (format #("vi: j, k, [q]: quit." 4 5 (face hydra-face-amaranth)
- 7 8 (face hydra-face-amaranth)
- 11 12 (face hydra-face-blue))))
- (message (format #("vi: j, k, [q]: quit." 4 5 (face hydra-face-amaranth)
- 7 8 (face hydra-face-amaranth)
- 11 12 (face hydra-face-blue))))))
- (defun hydra-vi/body nil "Create a hydra with no body and the heads:
+ (if hydra-lv
+ (lv-message
+ (format
+ #("vi: j, k, [q]: quit."
+ 4 5 (face hydra-face-amaranth)
+ 7 8 (face hydra-face-amaranth)
+ 11 12 (face hydra-face-blue))))
+ (message
+ (format
+ #("vi: j, k, [q]: quit."
+ 4 5 (face hydra-face-amaranth)
+ 7 8 (face hydra-face-amaranth)
+ 11 12 (face hydra-face-blue))))))
+ (defun hydra-vi/body nil
+ "Create a hydra with no body and the heads:
\"\a\": `hydra-keyboard-quit',
\"j\": `next-line',
\"q\": `nil'
The body can be accessed via `hydra-vi/body'."
- (interactive)
- (hydra-default-pre)
- (set-cursor-color "#e52b50")
- (hydra-disable)
- (catch (quote hydra-disable)
- (when hydra-is-helpful (hydra-vi/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-vi/keymap)
- t (lambda nil (hydra-keyboard-quit))))
- (setq prefix-arg current-prefix-arg)))))))
+ (interactive)
+ (hydra-default-pre)
+ (set-cursor-color "#e52b50")
+ (when hydra-is-helpful
+ (hydra-vi/hint))
+ (hydra-set-transient-map
+ hydra-vi/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ (set-cursor-color "#ffffff"))
+ (quote warn))
+ (setq prefix-arg
+ current-prefix-arg))))))
+
+(ert-deftest hydra-zoom-duplicate-1 ()
+ (should
+ (equal
+ (macroexpand
+ '(defhydra hydra-zoom ()
+ "zoom"
+ ("r" (text-scale-set 0) "reset")
+ ("0" (text-scale-set 0) :bind nil :exit t)
+ ("1" (text-scale-set 0) nil :bind nil :exit t)))
+ '(progn
+ (set
+ (defvar hydra-zoom/keymap nil
+ "Keymap for hydra-zoom.")
+ (quote (keymap (114 . hydra-zoom/lambda-r)
+ (7 . hydra-keyboard-quit)
+ (kp-subtract . hydra--negative-argument)
+ (kp-9 . hydra--digit-argument)
+ (kp-8 . hydra--digit-argument)
+ (kp-7 . hydra--digit-argument)
+ (kp-6 . hydra--digit-argument)
+ (kp-5 . hydra--digit-argument)
+ (kp-4 . hydra--digit-argument)
+ (kp-3 . hydra--digit-argument)
+ (kp-2 . hydra--digit-argument)
+ (kp-1 . hydra--digit-argument)
+ (kp-0 . hydra--digit-argument)
+ (57 . hydra--digit-argument)
+ (56 . hydra--digit-argument)
+ (55 . hydra--digit-argument)
+ (54 . hydra--digit-argument)
+ (53 . hydra--digit-argument)
+ (52 . hydra--digit-argument)
+ (51 . hydra--digit-argument)
+ (50 . hydra--digit-argument)
+ (49 . hydra-zoom/lambda-0-and-exit)
+ (48 . hydra-zoom/lambda-0-and-exit)
+ (45 . hydra--negative-argument)
+ (21 . hydra--universal-argument))))
+ (defun hydra-zoom/lambda-r nil
+ "Create a hydra with no body and the heads:
+
+\"r\": `(text-scale-set 0)',
+\"0\": `(text-scale-set 0)',
+\"1\": `(text-scale-set 0)'
+
+The body can be accessed via `hydra-zoom/body'.
+
+Call the head: `(text-scale-set 0)'."
+ (interactive)
+ (hydra-default-pre)
+ (condition-case err
+ (call-interactively
+ (function
+ (lambda nil
+ (interactive)
+ (text-scale-set 0))))
+ ((quit error)
+ (message "%S" err)
+ (unless hydra-lv (sit-for 0.8))))
+ (when hydra-is-helpful
+ (hydra-zoom/hint))
+ (hydra-set-transient-map
+ hydra-zoom/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ nil)
+ nil))
+ (defun hydra-zoom/lambda-0-and-exit nil
+ "Create a hydra with no body and the heads:
+
+\"r\": `(text-scale-set 0)',
+\"0\": `(text-scale-set 0)',
+\"1\": `(text-scale-set 0)'
+
+The body can be accessed via `hydra-zoom/body'.
+
+Call the head: `(text-scale-set 0)'."
+ (interactive)
+ (hydra-default-pre)
+ (hydra-keyboard-quit)
+ (call-interactively
+ (function
+ (lambda nil
+ (interactive)
+ (text-scale-set 0))))
+ nil)
+ (defun hydra-zoom/hint nil
+ (if hydra-lv
+ (lv-message
+ (format
+ #("zoom: [r 0]: reset."
+ 7 8 (face hydra-face-red)
+ 9 10 (face hydra-face-blue))))
+ (message
+ (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:
+
+\"r\": `(text-scale-set 0)',
+\"0\": `(text-scale-set 0)',
+\"1\": `(text-scale-set 0)'
+
+The body can be accessed via `hydra-zoom/body'."
+ (interactive)
+ (hydra-default-pre)
+ (when hydra-is-helpful
+ (hydra-zoom/hint))
+ (hydra-set-transient-map
+ hydra-zoom/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ nil)
+ nil)
+ (setq prefix-arg
+ current-prefix-arg))))))
+
+(ert-deftest hydra-zoom-duplicate-2 ()
+ (should
+ (equal
+ (macroexpand
+ '(defhydra hydra-zoom ()
+ "zoom"
+ ("r" (text-scale-set 0) "reset")
+ ("0" (text-scale-set 0) :bind nil :exit t)
+ ("1" (text-scale-set 0) nil :bind nil)))
+ '(progn
+ (set
+ (defvar hydra-zoom/keymap nil
+ "Keymap for hydra-zoom.")
+ (quote (keymap (114 . hydra-zoom/lambda-r)
+ (7 . hydra-keyboard-quit)
+ (kp-subtract . hydra--negative-argument)
+ (kp-9 . hydra--digit-argument)
+ (kp-8 . hydra--digit-argument)
+ (kp-7 . hydra--digit-argument)
+ (kp-6 . hydra--digit-argument)
+ (kp-5 . hydra--digit-argument)
+ (kp-4 . hydra--digit-argument)
+ (kp-3 . hydra--digit-argument)
+ (kp-2 . hydra--digit-argument)
+ (kp-1 . hydra--digit-argument)
+ (kp-0 . hydra--digit-argument)
+ (57 . hydra--digit-argument)
+ (56 . hydra--digit-argument)
+ (55 . hydra--digit-argument)
+ (54 . hydra--digit-argument)
+ (53 . hydra--digit-argument)
+ (52 . hydra--digit-argument)
+ (51 . hydra--digit-argument)
+ (50 . hydra--digit-argument)
+ (49 . hydra-zoom/lambda-r)
+ (48 . hydra-zoom/lambda-0-and-exit)
+ (45 . hydra--negative-argument)
+ (21 . hydra--universal-argument))))
+ (defun hydra-zoom/lambda-r nil
+ "Create a hydra with no body and the heads:
+
+\"r\": `(text-scale-set 0)',
+\"0\": `(text-scale-set 0)',
+\"1\": `(text-scale-set 0)'
+
+The body can be accessed via `hydra-zoom/body'.
+
+Call the head: `(text-scale-set 0)'."
+ (interactive)
+ (hydra-default-pre)
+ (condition-case err
+ (call-interactively
+ (function
+ (lambda nil
+ (interactive)
+ (text-scale-set 0))))
+ ((quit error)
+ (message "%S" err)
+ (unless hydra-lv (sit-for 0.8))))
+ (when hydra-is-helpful
+ (hydra-zoom/hint))
+ (hydra-set-transient-map
+ hydra-zoom/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ nil)
+ nil))
+ (defun hydra-zoom/lambda-0-and-exit nil
+ "Create a hydra with no body and the heads:
+
+\"r\": `(text-scale-set 0)',
+\"0\": `(text-scale-set 0)',
+\"1\": `(text-scale-set 0)'
+
+The body can be accessed via `hydra-zoom/body'.
+
+Call the head: `(text-scale-set 0)'."
+ (interactive)
+ (hydra-default-pre)
+ (hydra-keyboard-quit)
+ (call-interactively
+ (function
+ (lambda nil
+ (interactive)
+ (text-scale-set 0))))
+ nil)
+ (defun hydra-zoom/hint nil
+ (if hydra-lv
+ (lv-message
+ (format
+ #("zoom: [r 0]: reset."
+ 7 8 (face hydra-face-red)
+ 9 10 (face hydra-face-blue))))
+ (message
+ (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:
+
+\"r\": `(text-scale-set 0)',
+\"0\": `(text-scale-set 0)',
+\"1\": `(text-scale-set 0)'
+
+The body can be accessed via `hydra-zoom/body'."
+ (interactive)
+ (hydra-default-pre)
+ (when hydra-is-helpful
+ (hydra-zoom/hint))
+ (hydra-set-transient-map
+ hydra-zoom/keymap
+ (lambda nil
+ (hydra-keyboard-quit)
+ nil)
+ nil)
+ (setq prefix-arg
+ current-prefix-arg))))))
(ert-deftest defhydradio ()
(should (equal
("e" fun-e)
("f" fun-f))))))
-(ert-deftest hydra-zoom-duplicate-1 ()
- (should
- (equal
- (macroexpand
- '(defhydra hydra-zoom ()
- "zoom"
- ("r" (text-scale-set 0) "reset")
- ("0" (text-scale-set 0) :bind nil :exit t)
- ("1" (text-scale-set 0) nil :bind nil :exit t)))
- '(progn
- (set (defvar hydra-zoom/keymap nil "Keymap for hydra-zoom.")
- (quote (keymap (7 . hydra-keyboard-quit)
- (114 . hydra-zoom/lambda-r)
- (switch-frame . hydra--handle-switch-frame)
- (kp-subtract . hydra--negative-argument)
- (kp-9 . hydra--digit-argument)
- (kp-8 . hydra--digit-argument)
- (kp-7 . hydra--digit-argument)
- (kp-6 . hydra--digit-argument)
- (kp-5 . hydra--digit-argument)
- (kp-4 . hydra--digit-argument)
- (kp-3 . hydra--digit-argument)
- (kp-2 . hydra--digit-argument)
- (kp-1 . hydra--digit-argument)
- (kp-0 . hydra--digit-argument)
- (57 . hydra--digit-argument)
- (56 . hydra--digit-argument)
- (55 . hydra--digit-argument)
- (54 . hydra--digit-argument)
- (53 . hydra--digit-argument)
- (52 . hydra--digit-argument)
- (51 . hydra--digit-argument)
- (50 . hydra--digit-argument)
- (49 . hydra-zoom/lambda-0-and-exit)
- (48 . hydra-zoom/lambda-0-and-exit)
- (45 . hydra--negative-argument)
- (21 . hydra--universal-argument))))
- (defun hydra-zoom/lambda-r nil "Create a hydra with no body and the heads:
-
-\"r\": `(text-scale-set 0)',
-\"0\": `(text-scale-set 0)',
-\"1\": `(text-scale-set 0)'
-
-The body can be accessed via `hydra-zoom/body'.
-
-Call the head: `(text-scale-set 0)'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
- (condition-case err (call-interactively (function (lambda nil (interactive)
- (text-scale-set 0))))
- ((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8))))
- (when hydra-is-helpful (hydra-zoom/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-zoom/keymap)
- t (lambda nil (hydra-keyboard-quit))))))
- (defun hydra-zoom/lambda-0-and-exit nil "Create a hydra with no body and the heads:
-
-\"r\": `(text-scale-set 0)',
-\"0\": `(text-scale-set 0)',
-\"1\": `(text-scale-set 0)'
-
-The body can be accessed via `hydra-zoom/body'.
-
-Call the head: `(text-scale-set 0)'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (hydra-keyboard-quit)
- (catch (quote hydra-disable)
- (call-interactively (function (lambda nil (interactive)
- (text-scale-set 0))))))
- (defun hydra-zoom/hint nil
- (if hydra-lv (lv-message (format #("zoom: [r 0]: reset." 7 8 (face hydra-face-red)
- 9 10 (face hydra-face-blue))))
- (message (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:
-
-\"r\": `(text-scale-set 0)',
-\"0\": `(text-scale-set 0)',
-\"1\": `(text-scale-set 0)'
-
-The body can be accessed via `hydra-zoom/body'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
- (when hydra-is-helpful (hydra-zoom/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-zoom/keymap)
- t (lambda nil (hydra-keyboard-quit))))
- (setq prefix-arg current-prefix-arg)))))))
-
-(ert-deftest hydra-zoom-duplicate-2 ()
- (should
- (equal
- (macroexpand
- '(defhydra hydra-zoom ()
- "zoom"
- ("r" (text-scale-set 0) "reset")
- ("0" (text-scale-set 0) :bind nil :exit t)
- ("1" (text-scale-set 0) nil :bind nil)))
- '(progn
- (set (defvar hydra-zoom/keymap nil "Keymap for hydra-zoom.")
- (quote (keymap (7 . hydra-keyboard-quit)
- (114 . hydra-zoom/lambda-r)
- (switch-frame . hydra--handle-switch-frame)
- (kp-subtract . hydra--negative-argument)
- (kp-9 . hydra--digit-argument)
- (kp-8 . hydra--digit-argument)
- (kp-7 . hydra--digit-argument)
- (kp-6 . hydra--digit-argument)
- (kp-5 . hydra--digit-argument)
- (kp-4 . hydra--digit-argument)
- (kp-3 . hydra--digit-argument)
- (kp-2 . hydra--digit-argument)
- (kp-1 . hydra--digit-argument)
- (kp-0 . hydra--digit-argument)
- (57 . hydra--digit-argument)
- (56 . hydra--digit-argument)
- (55 . hydra--digit-argument)
- (54 . hydra--digit-argument)
- (53 . hydra--digit-argument)
- (52 . hydra--digit-argument)
- (51 . hydra--digit-argument)
- (50 . hydra--digit-argument)
- (49 . hydra-zoom/lambda-r)
- (48 . hydra-zoom/lambda-0-and-exit)
- (45 . hydra--negative-argument)
- (21 . hydra--universal-argument))))
- (defun hydra-zoom/lambda-r nil "Create a hydra with no body and the heads:
-
-\"r\": `(text-scale-set 0)',
-\"0\": `(text-scale-set 0)',
-\"1\": `(text-scale-set 0)'
-
-The body can be accessed via `hydra-zoom/body'.
-
-Call the head: `(text-scale-set 0)'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
- (condition-case err (call-interactively (function (lambda nil (interactive)
- (text-scale-set 0))))
- ((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8))))
- (when hydra-is-helpful (hydra-zoom/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-zoom/keymap)
- t (lambda nil (hydra-keyboard-quit))))))
- (defun hydra-zoom/lambda-0-and-exit nil "Create a hydra with no body and the heads:
-
-\"r\": `(text-scale-set 0)',
-\"0\": `(text-scale-set 0)',
-\"1\": `(text-scale-set 0)'
-
-The body can be accessed via `hydra-zoom/body'.
-
-Call the head: `(text-scale-set 0)'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (hydra-keyboard-quit)
- (catch (quote hydra-disable)
- (call-interactively (function (lambda nil (interactive)
- (text-scale-set 0))))))
- (defun hydra-zoom/hint nil
- (if hydra-lv (lv-message (format #("zoom: [r 0]: reset." 7 8 (face hydra-face-red)
- 9 10 (face hydra-face-blue))))
- (message (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:
-
-\"r\": `(text-scale-set 0)',
-\"0\": `(text-scale-set 0)',
-\"1\": `(text-scale-set 0)'
-
-The body can be accessed via `hydra-zoom/body'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
- (when hydra-is-helpful (hydra-zoom/hint))
- (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map hydra-zoom/keymap)
- t (lambda nil (hydra-keyboard-quit))))
- (setq prefix-arg current-prefix-arg)))))))
-
(ert-deftest hydra--pad ()
(should (equal (hydra--pad '(a b c) 3)
'(a b c)))