* hydra.el (hydra--hint): Don't add an extra newline.
* hydra-test.el (hydra-column-order): One newline less in expected string.
Also, re-indent the test code.
Fixes#303
Table doctrings generated from :column algorithm no longer have trailing
whitespace
Test hydra-column-1 modified accordingly
Trimming whitespace in hydra-test.el no longer breaks non-regression
This is a first rough implementation to gather early reviews
diff with code snippet from #147:
- Dash dependencies removed
- slight refactoring
Add basic column integration test.
Fixes#220
* 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.
* 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 (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-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-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).
* hydra.el (hydra-face-red):
(hydra-face-blue):
(hydra-face-amaranth):
(hydra-face-pink):
(hydra-face-teal): Improve docstrings.
(hydra--head-color): Simplify.
(defhydra): Use copy-sequence on inherited heads. Move :cmd-name setting
to the very end, when :exit is already set.
* hydra-test.el: Update tests.
* hydra.el (hydra--body-exit): New defun.
(defhydra): Ensure that each head doesn't need the :exit info from the
body any more by putting the aggregated :exit in the head's own plist.
* hydra-test.el: Update tests.
Each hydra will now declare its own heads as a variable `foo/heads`.
It's possible to inherit them like this:
(defhydra hydra-zoom-child (:inherit (hydra-zoom/heads))
"zoom"
("q" nil))
One hydra can inherit from multiple parents. This one just adds a single
"q" head to the familiar hydra-zoom.
Fixes#57.
* hydra.el (hydra--message): Remove.
(hydra--make-defun): Update.
(defhydra): Replace "defun foo/hint" with "defvar foo/hint".
This will allow to dynamically modify the hint in the future.
* hydra-test.el: Update tests.
* 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'.