* 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
* hydra.el (hydra--format): Update regex. Make sure that there's a
proper amount of escapes for %, since:
- it first gets evaled via `hydra-test/hint'
- it gets passed to `lv-message'
So to get 1 in the end, the initial amount can be 4.
* hydra-test.el (hydra-format-7): Add tests.
* hydra.el (hydra-pause-resume): New command.
(hydra-pause-ring): New defvar. Stores the paused hydras.
(hydra-keyboard-quit): Set `hydra-curr-map' to nil, so it's possible to
determine if any hydra is active.
(hydra--clearfun): Ignore `hydra-pause-resume', since the hydra needs to
be active for `hydra-pause-resume'.
Fixes#135
* hydra.el (hydra-curr-body-fn): New defvar.
(hydra--make-defun): All hydra heads will set `hydra-curr-body-fn' to
their respective "hydra.../body" function.
Users may read `hydra-curr-body-fn' from any head.
Re #127
* hydra.el (hydra-deactivate): Fix doc.
(hydra--ignore): Fix doc.
(hydra-amaranth-warn): Add doc.
(hydra--work-around-dedicated): Fix doc.
(hydra--hint): Work around a key being "%".
(hydra--strip-align-markers): New defun.
(hydra--format): Use `hydra--strip-align-markers'.
Fixes#126
* hydra.el (hydra--input-method-function): Move before first use.
(hydra--imf): New function.
(hydra-default-pre, hydra-disable): Use add/remove-function.
* hydra.el (hydra-fontify-head-default): Use head-exit. The heads have
been pre-processed to have it always set.
* hydra-test.el (hydra-format-4): Update test. The heads are passed to
`hydra--format' in the pre-processed state now (color and hint expanded).
* lv.el (lv-window): Prevent `balance-windows' and the like from messing
things up.
(lv-message): Bind `window-size-fixed' to nil for
`fit-window-to-buffer'.
Fixes#64