]> code.delx.au - gnu-emacs-elpa/commit
Call :post for :timeout
authorOleh Krehel <ohwoeowho@gmail.com>
Fri, 20 Mar 2015 14:27:00 +0000 (15:27 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Fri, 20 Mar 2015 14:27:00 +0000 (15:27 +0100)
commiteb181fde0cf12f2c46c92fe753918a291cf3bea0
tree5d9e7326bf70517adce9f80eccabd2550f2a9201
parentd44bf581d2c9cb831ccc5ac0fff24be4c36b8eed
Call :post for :timeout

* 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
hydra.el