Oleh Krehel [Thu, 16 Apr 2015 13:05:45 +0000 (15:05 +0200)]
Declare the hint early to avoid compile warnings
* hydra.el (hydra-fontify-head-greyscale): Update unused arg.
(hydra--make-defun): Update.
(hydra--head-name): Take one less arg.
(defhydra): Update hint position.
* hydra-init.el: Byte compile more stuff.
* hydra-test.el: Update tests.
* Makefile: Rename compile target to "run", update "compile".
With this code, `hydra-zoom/body' will display the hint not immediately
but after 1.0 seconds. If you manage to exit the hydra by then, the hint
will not be displayed. Other functions will display the hint
immediately.
Oleh Krehel [Tue, 14 Apr 2015 11:34:09 +0000 (13:34 +0200)]
Work around `overriding-terminal-local-map' being terminal-local
* hydra.el (hydra-disable): Try to reset `overriding-terminal-local-map'
for each frame, so that it doesn't happen that the hydra is cancelled
in one frame, but not in the other. `hydra-curr-on-exit' is called in
the first frame for which there's a transient map.
(hydra--clearfun): Disable when `overriding-terminal-local-map' is nil.
Oleh Krehel [Mon, 13 Apr 2015 12:08:43 +0000 (14:08 +0200)]
hydra.el (hydra--head-color): Simplify
* 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.
Just flatten these two functions to their 25.2 bodies, and don't call
the `set-transient-map' variants, since the map remains anyway because
of `hydra-base-map'.
Oleh Krehel [Mon, 13 Apr 2015 09:33:01 +0000 (11:33 +0200)]
Finalize head inheritance
* 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:
Oleh Krehel [Tue, 31 Mar 2015 15:48:50 +0000 (17:48 +0200)]
Move away from setting "t" in keymaps
* hydra.el (hydra-curr-on-exit): New defvar.
(hydra-curr-foreign-keys): New defvar.
(hydra-clearfun): New defun.
(hydra-amaranth-warn): New defun.
(hydra-set-transient-map): Use own defun instead of `set-transient-map'.
(hydra--universal-argument): Update.
(hydra--make-defun): Update.
(hydra--handle-nonhead): Remove.
(defhydra): Update.
Oleh Krehel [Sat, 28 Mar 2015 16:08:00 +0000 (17:08 +0100)]
hydra.el (defhydra): Simplify :cmd-name part
* hydra.el (defhydra): When a plist isn't nil, `plist-put' can be used,
which is useful to overwrite :cmd-name if it's present. When plist is
nil, use the old code.
Oleh Krehel [Mon, 23 Mar 2015 17:29:49 +0000 (18:29 +0100)]
Fix blue/red heads with same cmd
* hydra.el (hydra--make-defun): Update.
(hydra--head-name): Change signature, since body is needed to determine
the color. When the head will exit, add "-and-exit" to its name (except
for the nil head and body).
(defhydra): Update the call to `hydra--head-name', since it's not valid
until the head has a hint.
Oleh Krehel [Fri, 20 Mar 2015 14:27:00 +0000 (15:27 +0100)]
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.
- 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.
jhonnyseven [Fri, 13 Mar 2015 14:12:21 +0000 (16:12 +0200)]
Fix switch-frame handling.
Calling only `hydra-keyboard-quit' on switch-frame event was
effectively stopping the original frame switch. This change adds a
call to the original handler after calling `hydra-keyboard-quit'.
Oleh Krehel [Thu, 12 Mar 2015 13:00:09 +0000 (14:00 +0100)]
lv.el: Update truncation rules
* lv.el (lv-window): Defer `truncate-lines' to `lv-message'. Set window
hscroll to 0, just in case.
(lv-message): If STR is one-line, set `truncate-lines' to nil, otherwise
set it to t. Make `window-min-height' buffer-local and set it to the
amount of newlines in STR.
Oleh Krehel [Wed, 11 Mar 2015 10:11:20 +0000 (11:11 +0100)]
Makefile: Simplify
* hydra-init.el: Add bare init.
Now, typing:
make compile
in the hydra repository will start an "emacs -q" with all hydras from
hydra-examples.el defined. Thus you can test that they work for you.
The simplest one is "<f2> g", you can type that in any buffer.
If you want to test with a different version of emacs, just type e.g.:
Oleh Krehel [Tue, 10 Mar 2015 08:32:12 +0000 (09:32 +0100)]
"C-g" (`hydra-keyboard-quit' ) should run :post
* hydra.el (hydra--handle-nonhead): Bind the plain `hydra-keyboard-quit'
only when there's no :post.
(defhydra): When there's :post, add another head for keyboard quit.
Oleh Krehel [Fri, 6 Mar 2015 15:00:11 +0000 (16:00 +0100)]
Add option to specify :hint in body
* hydra.el (hydra-plist-get-default): New defun, extended `plist-get'.
(hydra--head-property): Use `hydra-plist-get-default'.
(defhydra): The heads will inherit their hint from body :hint parameter.
They can override it, of course.
The most use you can get out of this parameter is to specify :hint nil
for hydras with a format-style docstring.
Oleh Krehel [Thu, 5 Mar 2015 20:29:50 +0000 (21:29 +0100)]
hydra-ox.el: Emulate org-mode export dispatch
* hydra-ox.el (hydra-ox): New radiogroup.
(hydra-ox-html): New hydra.
(hydra-ox-latex): New hydra.
(hydra-ox-text): New hydra.
(hydra-ox): New hydra that includes the above three hydras.
(org-mode-map): Add test binding.
Oleh Krehel [Mon, 2 Mar 2015 20:47:50 +0000 (21:47 +0100)]
Add :timeout option to hydra body
* hydra.el (hydra--make-defun): Call `hydra-timeout' with :timeout if
it's given.
(hydra-timer): New var to hold the timer.
(hydra-timeout): New function to call `hydra-keyboard-quit' with delay.
(hydra-keyboard-quit): Cancel `hydra-timeout' timer.
Oleh Krehel [Fri, 27 Feb 2015 18:05:43 +0000 (19:05 +0100)]
Add some features for generating tables
* hydra.el (hydra--pad): New defun.
(hydra--matrix): New defun.
(hydra--cell): New defun.
(hydra--vconcat): New defun.
(hydra-cell-format): New defcustom.
(hydra--table): New defun.
(hydra-reset-radios): New defun.
(defhydra): Allow docstring to be eval-able.
(defhydradio): Don't define `.../reset-radios', instead define
`.../names' that can be passed to `hydra-reset-radios'.
(hydra-multipop): New defmacro.
(hydra--radio): Update the order - the docstring is now a mandatory
second arg, value is the optional third.