* hydra.el (hydra--make-defun): Rewrite `hydra-show-hint' arglist. The
hydra name should also be passed.
(hydra-set-property): New defun.
(hydra-show-hint): Add `caller' arg - the name of the hydra. It can be
used as a key in `hydra-props-alist'.
(hydra-idle-message): Add arg.
* hydra-test.el: Update tests.
* hydra-test.el: Update tests.
There should be no change in the behavior, but now the code that shows
the hint is all conveniently in a single defun, instead of separately in
each hydra's each head.
It's not necessary, and sometimes not even appropriate to `eval' the
head's hint. For instance, the hint may assume being in some particular
state, like `org-agenda-mode' etc.
* hydra-examples.el (hydra-org-agenda-view): New example.
* hydra.el (hydra--format): Revert to the old behavior for (:hint nil).
Turn off the bottom hint completely for (:hint none).
Fixes#190
* hydra.el (hydra--format): When body's :hint is nil /and/ the docstring
starts with a newline, set the output of `hydra--hint' to "".
This is necessary for the ?x? syntax.
* hydra-test.el (hydra-format-8): Add test.
Fixes#190
* hydra.el (hydra-docstring-keys-translate-alist): New defvar.
(hydra--format): Add "↑" to the regex, modify the head accordingly for
the `hydra-fontify-head' call.
Re #186
* hydra.el (hydra-disable): Move the action calling code out
of (frame-list) loop.
The (frame-list) loop was added to fix#105 to restor the
terminal-local-map in all frames. There's no reason for action-calling
code to be in that loop.
Fixes#169.
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 (hydra-disable): Deactivate key-chord advice even if
`overriding-terminal-local-map' is nil. This situation can happen with
`multiple-cursors', since it calls `hydra-disable' multiple times, and
`hydra-default-pre' is called multiple times as well.
Fixes#163
* hydra.el (hydra--make-callable):
(hydra--head-name): Allow #'command syntax in the CMD place for each
head.
This isn't the recommended syntax, however you can use it if you prefer.
Fixes#156
* hydra.el (defhydra): In generated `define-key' statement use `quote'
instead of `function'.
* hydra-test.el (hydra-red-error): Update test.
This should fix the byte compiler warning for hydra-examples.el.
* hydra.el (hydra-key-doc-function): New defvar.
(hydra-key-doc-function-default): New defun.
(hydra--hint): Add a new branch for the case :columns is specified; when
there are no columns, move the final dot here from `hydra--format'.
(hydra--format): Move final dot.
* hydra-test.el (hydra-format-1):
(hydra-format-2):
(hydra-format-with-sexp-1):
(hydra-format-with-sexp-2): Move final dot.
(hydra-columns-1): Add test.
See the code in `hydra-columns-1' test for a new approach to defining
hydras with 2D docstrings. Compared to doing it by-hand, the new method
is more flexible in one place (heads and head hints can be updated
easily) and less flexible in other (the method of joining head hints is
fixed), but very simple and short.
Example:
(defhydra hydra-info (:color blue
:columns 3)
"Info-mode"
("?" Info-summary "summary")
("]" Info-forward-node "forward")
("[" Info-backward-node "backward")
("<" Info-top-node "top node")
(">" Info-final-node "final node")
("h" Info-help "help")
("d" Info-directory "info dir")
("f" Info-follow-reference "follow ref")
("g" Info-goto-node "goto node")
("l" Info-history-back "hist back")
("r" Info-history-forward "hist forward")
("i" Info-index "index")
("I" Info-virtual-index "virtual index")
("L" Info-history "hist")
("n" Info-next "next")
("p" Info-prev "previous")
("s" Info-search "search")
("S" Info-search-case-sensitively "case-search")
("T" Info-toc "TOC")
("u" Info-up "up")
("m" Info-menu "menu"))
Similar one done by-hand:
(defhydra hydra-info (:color blue :hint nil)
"
Info-mode:
[_?_] summary [_[_] forward [_g_] goto node
[_<_] top node [_]_] backward [_s_] search
[_>_] final node [_f_] follow ref [_S_] case-search
[_d_] info dir [_l_] hist back [_m_] menu
[_i_] index [_r_] hist forward [_h_] help
[_I_] virtual index [_n_] next
[_L_] hist [_p_] previous
[_T_] TOC [_u_] up
"
("?" Info-summary)
("]" Info-forward-node)
("[" Info-backward-node)
("<" Info-top-node)
(">" Info-final-node)
("h" Info-help)
("d" Info-directory)
("f" Info-follow-reference)
("g" Info-goto-node)
("l" Info-history-back)
("r" Info-history-forward)
("i" Info-index)
("I" Info-virtual-index)
("L" Info-history)
("n" Info-next)
("p" Info-prev)
("s" Info-search)
("S" Info-search-case-sensitively)
("T" Info-toc)
("u" Info-up)
("m" Info-menu))
Fixes#140