]> code.delx.au - gnu-emacs-elpa/commit
Allow head-hint to be dynamic
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 19 Oct 2015 09:29:01 +0000 (11:29 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 19 Oct 2015 09:33:36 +0000 (11:33 +0200)
commit9f5f089af4627f100f8ae453773aa6382fee44d1
tree47fb6853a351685c748d0b8a6259a5530f7c0235
parent0712176e9b0cbab178e2d20aeab7711188ce8ee7
Allow head-hint to be dynamic

Instead of only a string like before, the head-hint can be anything that
evaluates to a string.

Example:

(defhydra hydra-test (:columns 2)
  "Test"
  ("j" next-line (format-time-string "%H:%M:%S" (current-time)))
  ("k" previous-line (format-time-string "%H:%M:%S" (current-time)))
  ("h" backward-char (format-time-string "%H:%M:%S" (current-time)))
  ("l" forward-char (format-time-string "%H:%M:%S" (current-time))))

Pressing "hjkl" will refresh the hint, and thus update the current time.
Note that the hint needs to evaluate to a string at both compile-time
and run-time. The column formatting depends on the compile-time result.

Fixes #160
hydra.el