* hydra.el (hydra--clearfun): Update.
(hydra-keyboard-quit): Remove defcustom.
(defhydra): Update.
* hydra-test.el: Update tests.
(hydra-integration-1): Catch the 'quit signal, since now "C-g" is just a
plain `keyboard-quit'.
* hydra.el (hydra-curr-on-exit): New defvar.
(hydra-curr-foreign-keys): New defvar.
(hydra-clearfun): New defun.
(hydra-amaranth-warn): New defun.
(hydra-set-transient-map): Use own defun instead of `set-transient-map'.
(hydra--universal-argument): Update.
(hydra--make-defun): Update.
(hydra--handle-nonhead): Remove.
(defhydra): Update.
Re #90
* hydra.el (defhydra): When a plist isn't nil, `plist-put' can be used,
which is useful to overwrite :cmd-name if it's present. When plist is
nil, use the old code.
* hydra.el (hydra--make-defun): It will receive not the keymap, but the
variable that hold the keymap.
(defhydra): Define keymap as a variable.
* hydra-test.el (hydra-red-error): Update test.
(hydra-blue-toggle): Update test.
(hydra-amaranth-vi): Update test.
(hydra-zoom-duplicate-1): Update test.
(hydra-zoom-duplicate-2): Update test.
* hydra.el (hydra-repeat): Update.
It's possible now, for instance with `hydra-vi' to do this:
4j.2..
This will forward-line 4 times (4j), 4 times (.), 2 times (2.), 2
times (.).
Fixes#92
* hydra.el (hydra--make-defun): Update.
(hydra--head-name): Change signature, since body is needed to determine
the color. When the head will exit, add "-and-exit" to its name (except
for the nil head and body).
(defhydra): Update the call to `hydra--head-name', since it's not valid
until the head has a hint.
* hydra-test.el (hydra-blue-toggle): Update.
(hydra-amaranth-vi): Update.
(hydra-zoom-duplicate-1): Update.
(hydra-zoom-duplicate-2): Update.
Fixes#84
* hydra.el (hydra--format): Update. Treat variables in the same way as
s-expressions.
* hydra-test.el (hydra-format-2): Add test.
(hydra-format-with-sexp-2): Add test.
Fixes#85
* hydra.el (hydra--make-defun): When both :timeout and :post are given,
if `hydra-timeout' runs out, it will call :post before
`hydra-keyboard-quit'.
(hydra-timeout): Update to call function if it's given. Always call
`hydra-keyboard-quit' afterwards.
For this example code:
(global-set-key
(kbd "C-c t")
(defhydra test-hydra-b
(:timeout 2.0 :post (message "test b quit"))
"test b"
("x" (message "x"))
("y" (message "y"))
("q" nil "quit")))
The message "test b quit" is issued:
- on "q"
- on "x" or "y", after one of them has started the timer, and the timer
ran out. The timer is set to 2.0 seconds, and is reset each time "x"
or "y" is pressed.
- not on a plain "C-c t"
Fixes#34
Calling only `hydra-keyboard-quit' on switch-frame event was
effectively stopping the original frame switch. This change adds a
call to the original handler after calling `hydra-keyboard-quit'.
See #73
* hydra.el: Add `hydra--handle-switch-frame'
* hydra-test.el: Update
Fixes#77
* hydra.el (hydra--handle-nonhead): Bind the plain `hydra-keyboard-quit'
only when there's no :post.
(defhydra): When there's :post, add another head for keyboard quit.
* hydra-test.el (hydra-amaranth-vi): Update test.
Fixes#67.
* hydra.el (hydra-set-transient-map): Avoid compiler warnings.
(hydra--format): Add s? to regex.
- %(test) will translate to (format "%S" (test))
- %s(test) will translate to (format "%s" (test))
The width specifiers should work for both, e.g. % -10(test) or %
-10s(test).
Example:
(defhydra hydra-marked-items (dired-mode-map "")
"
Number of marked items: %(length (dired-get-marked-files))
Directory size: %s(shell-command-to-string \"du -hs\")
"
("m" dired-mark "mark"))
Fixes#65.
* hydra.el (hydra--make-defun): Call `hydra-timeout' with :timeout if
it's given.
(hydra-timer): New var to hold the timer.
(hydra-timeout): New function to call `hydra-keyboard-quit' with delay.
(hydra-keyboard-quit): Cancel `hydra-timeout' timer.
Re #34.
* hydra.el (hydra--pad): New defun.
(hydra--matrix): New defun.
(hydra--cell): New defun.
(hydra--vconcat): New defun.
(hydra-cell-format): New defcustom.
(hydra--table): New defun.
(hydra-reset-radios): New defun.
(defhydra): Allow docstring to be eval-able.
(defhydradio): Don't define `.../reset-radios', instead define
`.../names' that can be passed to `hydra-reset-radios'.
(hydra-multipop): New defmacro.
(hydra--radio): Update the order - the docstring is now a mandatory
second arg, value is the optional third.
* hydra-test.el (defhydradio): Update test.
(hydra--pad): Add test.
(hydra--matrix): Add test.
(hydra--cell): Add test.
(hydra--vconcat): Add test.
(hydra--table): Add test.
* hydra.el (hydra-repeat): New defun.
(hydra-repeat--command): New defvar.
(hydra-repeat--prefix-arg): New defvar.
Example:
(defhydra hydra-vi ()
"vi"
("h" backward-char)
("j" next-line)
("k" previous-line)
("l" forward-char)
("." hydra-repeat))
(global-set-key (kbd "C-v") 'hydra-vi/body)
"C-v 4l.." will result in movement forward by 4 chars 3 times: first
time from "4l", the other two from "..".
Fixes#59.