]> code.delx.au - gnu-emacs-elpa/log
gnu-emacs-elpa
9 years agoUse `condition-case-unless-debug'
Oleh Krehel [Thu, 16 Apr 2015 18:34:19 +0000 (20:34 +0200)]
Use `condition-case-unless-debug'

9 years agoDeclare the hint early to avoid compile warnings
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".

9 years agohydra.el: Bump version
Oleh Krehel [Thu, 16 Apr 2015 12:13:37 +0000 (14:13 +0200)]
hydra.el: Bump version

9 years agoDon't re-activate key chords too early
Oleh Krehel [Wed, 15 Apr 2015 17:49:48 +0000 (19:49 +0200)]
Don't re-activate key chords too early

* hydra.el (hydra-disable): Re-activate key chords only if
  `hydra--ignore' is nil.
(hydra-keyboard-quit): Update.

Re #97

9 years agohydra.el (defhydra): Re-throw a caught error when debug-on-error
Oleh Krehel [Wed, 15 Apr 2015 08:07:24 +0000 (10:07 +0200)]
hydra.el (defhydra): Re-throw a caught error when debug-on-error

* hydra.el (defhydra): Update.

9 years agoAdd an idle message timeout option
Oleh Krehel [Wed, 15 Apr 2015 07:15:35 +0000 (09:15 +0200)]
Add an idle message timeout option

* hydra.el (hydra-keyboard-quit): Update.
(hydra--make-defun): Update.
(hydra-timeout-timer): Rename from `hydra-timer'.
(hydra-message-timer): New defvar.
(hydra-idle-message): New defun.
(hydra-timeout): Update.

Small example:

(defhydra hydra-zoom (:idle 1.0)
  "zoom"
  ("g" text-scale-increase "in")
  ("l" text-scale-decrease "out"))
(global-set-key (kbd "<f2> g") 'hydra-zoom/body)

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.

Fixes #108

9 years agohydra.el (hydra--format): Fix "s-t" issue
Oleh Krehel [Wed, 15 Apr 2015 08:12:39 +0000 (10:12 +0200)]
hydra.el (hydra--format): Fix "s-t" issue

* hydra.el (hydra--format): Update.

Fixes #107.

9 years agoAdd integration test for red hydras temporarily exiting
Oleh Krehel [Wed, 15 Apr 2015 06:49:39 +0000 (08:49 +0200)]
Add integration test for red hydras temporarily exiting

* hydra-test.el (hydra-simple-3): Add.
(hydra-integration-3): Add.

Re #109

9 years agoFix red heads not exiting temporarily
Oleh Krehel [Wed, 15 Apr 2015 06:43:23 +0000 (08:43 +0200)]
Fix red heads not exiting temporarily

* hydra.el (hydra--ignore): New defvar.
(hydra-disable): Don't call :post unless `hydra--ignore' is nil.
(hydra--make-defun): Temporarily disable transient map before calling
the command.

Fixes #109

9 years agoREADME.md: Update `hydra-zoom/body'
Oleh Krehel [Tue, 14 Apr 2015 13:59:27 +0000 (15:59 +0200)]
README.md: Update `hydra-zoom/body'

9 years agoREADME.md: Update intro
Oleh Krehel [Tue, 14 Apr 2015 13:54:56 +0000 (15:54 +0200)]
README.md: Update intro

9 years agohydra.el (hydra--format): Match alnum for the "_..._" syntax
Oleh Krehel [Tue, 14 Apr 2015 12:29:22 +0000 (14:29 +0200)]
hydra.el (hydra--format): Match alnum for the "_..._" syntax

Fixes #106

9 years agoWork around `overriding-terminal-local-map' being terminal-local
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.

Fixes #105

9 years agoREADME.md: Add video demo link
Oleh Krehel [Tue, 14 Apr 2015 08:45:28 +0000 (10:45 +0200)]
README.md: Add video demo link

9 years agoMove `this-command' setter
Oleh Krehel [Mon, 13 Apr 2015 21:14:05 +0000 (23:14 +0200)]
Move `this-command' setter

* hydra.el (hydra--call-interactively): New defun.
(hydra--make-defun): Update.

Re #79

9 years agoSet `this-command' when appropriate
Oleh Krehel [Mon, 13 Apr 2015 19:29:45 +0000 (21:29 +0200)]
Set `this-command' when appropriate

* hydra.el (hydra--make-defun): Update.

* hydra-test.el: Update tests.

Re #79

9 years agohydra.el (hydra--head-color): Remove
Oleh Krehel [Mon, 13 Apr 2015 12:31:36 +0000 (14:31 +0200)]
hydra.el (hydra--head-color): Remove

* hydra.el (hydra-fontify-head-default): Move `hydra--head-color' body
  here.
(hydra-fontify-head-greyscale): Simplify.
(hydra--make-defun): Simplify.
(hydra--head-name): Simplify.
(hydra--delete-duplicates): Update.
(defhydra): Update.

9 years agohydra.el (hydra--head-color): Simplify
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.

* hydra-test.el: Update tests.

9 years agoMake digit and negative arguments work in 24.3
Oleh Krehel [Mon, 13 Apr 2015 10:26:02 +0000 (12:26 +0200)]
Make digit and negative arguments work in 24.3

* hydra.el (hydra--digit-argument): Update.
(hydra--negative-argument): Update.

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'.

9 years agoAdd an integration test for digit args in amaranth
Oleh Krehel [Mon, 13 Apr 2015 10:01:58 +0000 (12:01 +0200)]
Add an integration test for digit args in amaranth

* hydra-test.el (hydra-simple-1): Rename.
(hydra-simple-2): New auxiliary hydra.
(hydra-integration-2): Add test.

Re #104

9 years agoAccount for digit argument
Oleh Krehel [Mon, 13 Apr 2015 09:51:10 +0000 (11:51 +0200)]
Account for digit argument

* hydra.el (hydra--clearfun): Update. digit-argument will modify
  this-command-keys-vector, but not this-single-command-keys.

Fixes #104

9 years agoFinalize head inheritance
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:

(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.

9 years agohydra.el (hydra--body-color): Remove
Oleh Krehel [Sun, 12 Apr 2015 11:57:00 +0000 (13:57 +0200)]
hydra.el (hydra--body-color): Remove

* hydra.el (hydra--head-color): Update.
(hydra--make-defun): Update.
(defhydra): Update.

9 years agohydra.el (hydra--face): Remove
Oleh Krehel [Sun, 12 Apr 2015 11:36:25 +0000 (13:36 +0200)]
hydra.el (hydra--face): Remove

* hydra.el (hydra-fontify-head-default): Update.

9 years agoUse a variable instead of a function for the hint
Oleh Krehel [Sat, 11 Apr 2015 16:37:09 +0000 (18:37 +0200)]
Use a variable instead of a function for the hint

* 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.

9 years agoUse `unwind-protect' for :after-exit
Oleh Krehel [Sat, 11 Apr 2015 13:27:46 +0000 (15:27 +0200)]
Use `unwind-protect' for :after-exit

* hydra.el (hydra--make-defun): Update.

This change makes "C-g" work for this hydra:

(defhydra hydra-goto-line (global-map "M-g"
                           :pre (linum-mode 1)
                           :after-exit (linum-mode -1)
                           :exit t)
  ("g" goto-line "line")
  ("c" goto-char "char"))

Re #90

9 years agoAdd basic error handling
Oleh Krehel [Sat, 11 Apr 2015 09:38:18 +0000 (11:38 +0200)]
Add basic error handling

* hydra.el (defhydra): When the macro fails, message an error and
  continue as if the defhydra call wasn't there.

9 years agoAlias :post to :before-exit, and add :after-exit
Oleh Krehel [Sat, 11 Apr 2015 09:28:01 +0000 (11:28 +0200)]
Alias :post to :before-exit, and add :after-exit

* hydra.el (hydra--make-defun): Update.
(hydra--make-funcall): Update doc.
(defhydra): Update.

Re #90

9 years agoSimplify `keyboard-quit'
Oleh Krehel [Thu, 9 Apr 2015 13:57:30 +0000 (15:57 +0200)]
Simplify `keyboard-quit'

* 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'.

9 years agoDon't double-call :post
Oleh Krehel [Thu, 9 Apr 2015 13:50:44 +0000 (15:50 +0200)]
Don't double-call :post

* hydra.el (hydra--make-defun): Update.

* hydra-test.el: Update tests.

:post will be called via `hydra-curr-on-exit' in `hydra-disable'.

Re #90

9 years agoUpdate the tests for the new `hydra-set-transient-map'
Oleh Krehel [Thu, 9 Apr 2015 12:07:48 +0000 (14:07 +0200)]
Update the tests for the new `hydra-set-transient-map'

* hydra-test.el (hydra-red-error): Update.
(hydra-blue-toggle): Update.
(hydra-amaranth-vi): Update.
(hydra-zoom-duplicate-1): Update.
(hydra-zoom-duplicate-2): Update.

Re #90

9 years agoQuit Hydra for `handle-switch-frame'
Oleh Krehel [Thu, 9 Apr 2015 11:07:43 +0000 (13:07 +0200)]
Quit Hydra for `handle-switch-frame'

* hydra.el (hydra--clearfun): Update.
(hydra-base-map): Update.
(hydra--handle-switch-frame): Remove.

Re #90, #73.

9 years agoAdapt to the new `hydra-set-transient-map'
Oleh Krehel [Thu, 9 Apr 2015 09:21:08 +0000 (11:21 +0200)]
Adapt to the new `hydra-set-transient-map'

* hydra.el (hydra-set-transient-map): Amend arglist.
(hydra--clearfun): Don't count on there being another transient map.
(hydra-disable): Update.
(internal-push-keymap): Define unless defined.
(internal-pop-keymap): Define unless defined.
(hydra--pred): Remove.
(hydra--universal-argument): Update.
(hydra-last): Remove.
(hydra--aggregate-color): Remove.
(hydra--unalias-var): Remove.
(hydra-pink-fallback): Remove.
(hydra--modify-keymap): Remove.
(hydra--make-defun): Update.

Re #90

9 years agoMove away from setting "t" in keymaps
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.

Re #90

9 years agoTry to re-encode the input in the terminal
Oleh Krehel [Tue, 31 Mar 2015 13:35:25 +0000 (15:35 +0200)]
Try to re-encode the input in the terminal

* hydra.el (hydra--handle-nonhead): Update. Most interesting sequences
  start with [27 91] or [27 79]. It's hard to do it for all of them.

Re #90

9 years agohydra.el (hydra--format): Add some more symbols
Oleh Krehel [Fri, 10 Apr 2015 17:57:10 +0000 (19:57 +0200)]
hydra.el (hydra--format): Add some more symbols

Re #103 #102

9 years agoUpdate testing setup
Oleh Krehel [Tue, 31 Mar 2015 12:48:14 +0000 (14:48 +0200)]
Update testing setup

* .travis.yml: Add emacs-snapshot.

* Makefile: Echo the path to the emacs binary.

* hydra-test.el: Echo Emacs version.

9 years agoAdd integration testing
Oleh Krehel [Tue, 31 Mar 2015 12:38:52 +0000 (14:38 +0200)]
Add integration testing

* hydra-test.el (hydra-simple): Add example hydra that will be run.
(hydra-with): New defmacro.
(hydra-integration-1): Add test.

Re #101

9 years agohydra.el (hydra-set-transient-map): Update
Oleh Krehel [Tue, 31 Mar 2015 12:12:41 +0000 (14:12 +0200)]
hydra.el (hydra-set-transient-map): Update

A quick fix for the recursion issue in Emacs 25.

I'll have to see at some point why the recursion was happening.

Fixes #101

9 years agohydra.el (hydra-pink-fallback): Allow prefix arguments
Oleh Krehel [Tue, 31 Mar 2015 09:40:05 +0000 (11:40 +0200)]
hydra.el (hydra-pink-fallback): Allow prefix arguments

* hydra.el (hydra-pink-fallback): Update.

Fixes #93

9 years agoUse `hydra-keyboard-quit' instead of `hydra-cleanup'
Oleh Krehel [Tue, 31 Mar 2015 08:00:53 +0000 (10:00 +0200)]
Use `hydra-keyboard-quit' instead of `hydra-cleanup'

* hydra.el (hydra--pred): Update.
(hydra--make-defun): Update.
(hydra-cleanup): Remove.
(hydra-keyboard-quit): Absorb `hydra-cleanup'.

* hydra-test.el (hydra-red-error): Update test.
(hydra-blue-toggle): Update test.
(hydra-amaranth-vi): Update test.
(hydra-zoom-duplicate-1): Update test.
(hydra-zoom-duplicate-2): Update test.

Fixes #100

9 years agohydra.el (hydra--make-funcall): Update location
Oleh Krehel [Sat, 28 Mar 2015 18:17:52 +0000 (19:17 +0100)]
hydra.el (hydra--make-funcall): Update location

Fixes #99

9 years agohydra.el (hydra--digit-argument): Fix for Emacs 24.3
Oleh Krehel [Sat, 28 Mar 2015 17:15:58 +0000 (18:15 +0100)]
hydra.el (hydra--digit-argument): Fix for Emacs 24.3

* hydra.el (hydra--digit-argument): Update.

Fixes #98

9 years agohydra.el (defhydra): Simplify :cmd-name part
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.

9 years agoUse set/defvar for keymap
Oleh Krehel [Sat, 28 Mar 2015 16:05:47 +0000 (17:05 +0100)]
Use set/defvar for keymap

* hydra.el (defhydra): Update. This should facilitate debugging, since a
  plain defvar wouldn't be re-evaluated.

* hydra-test.el (hydra-red-error): Update test.
(hydra-blue-toggle): Update test.
(hydra-amaranth-vi): Update test.
(hydra-zoom-duplicate-1): Update test.
(hydra-zoom-duplicate-2): Update test.

9 years agoDefine a keymap var for each hydra and re-use it
Oleh Krehel [Sat, 28 Mar 2015 15:08:03 +0000 (16:08 +0100)]
Define a keymap var for each hydra and re-use it

* hydra.el (hydra--make-defun): It will receive not the keymap, but the
  variable that hold the keymap.
(defhydra): Define keymap as a variable.

* hydra-test.el (hydra-red-error): Update test.
(hydra-blue-toggle): Update test.
(hydra-amaranth-vi): Update test.
(hydra-zoom-duplicate-1): Update test.
(hydra-zoom-duplicate-2): Update test.

9 years agohydra.el: Bump version
Oleh Krehel [Sat, 28 Mar 2015 14:57:03 +0000 (15:57 +0100)]
hydra.el: Bump version

9 years agohydra.el (defhydra): Avoid eager macroexpansion failure
Oleh Krehel [Sat, 28 Mar 2015 14:34:11 +0000 (15:34 +0100)]
hydra.el (defhydra): Avoid eager macroexpansion failure

* hydra.el (defhydra): Don't test with keymapp, unless the symbol is
  bound. When the mode isn't loaded yet, the keymap symbol isn't bound.

9 years agohydra.el (defhydra): Simplify and improve the key binding code
Oleh Krehel [Sat, 28 Mar 2015 14:06:27 +0000 (15:06 +0100)]
hydra.el (defhydra): Simplify and improve the key binding code

* hydra.el (defhydra): Update.

As a side effect, :bind head property can now be a keymap, in addition
to a lambda.

9 years agohydra.el (hydra--make-funcall): Add
Oleh Krehel [Sat, 28 Mar 2015 13:26:26 +0000 (14:26 +0100)]
hydra.el (hydra--make-funcall): Add

* hydra-test.el (hydra--make-funcall): Add test.

9 years agohydra.el (defhydra): Improve docstring
Oleh Krehel [Sat, 28 Mar 2015 12:57:01 +0000 (13:57 +0100)]
hydra.el (defhydra): Improve docstring

9 years agoDisable key-chord for the duration of the hydra
Oleh Krehel [Fri, 27 Mar 2015 15:22:40 +0000 (16:22 +0100)]
Disable key-chord for the duration of the hydra

* hydra.el (hydra--input-method-function): New defvar.
(hydra-default-pre): Disable key-chord.
(hydra-cleanup): Re-enable key-chord.
(hydra--make-defun): Call `hydra-default-pre' for each head.

Fixes #97

9 years agohydra-test.el (hydra-format-4): Add test
Oleh Krehel [Fri, 27 Mar 2015 10:04:54 +0000 (11:04 +0100)]
hydra-test.el (hydra-format-4): Add test

Re #94

9 years agohydra-examples.el (hydra-rectangle): Update
Oleh Krehel [Thu, 26 Mar 2015 21:11:24 +0000 (22:11 +0100)]
hydra-examples.el (hydra-rectangle): Update

9 years agohydra.el (hydra--format): Update regex order
Oleh Krehel [Thu, 26 Mar 2015 19:29:13 +0000 (20:29 +0100)]
hydra.el (hydra--format): Update regex order

9 years agohydra.el (hydra--format): Amend regex
Oleh Krehel [Thu, 26 Mar 2015 14:56:56 +0000 (15:56 +0100)]
hydra.el (hydra--format): Amend regex

9 years agoAllow `hydra-repeat' to take a numeric arg
Oleh Krehel [Wed, 25 Mar 2015 19:17:48 +0000 (20:17 +0100)]
Allow `hydra-repeat' to take a numeric arg

* hydra.el (hydra-repeat): Update.

It's possible now, for instance with `hydra-vi' to do this:

    4j.2..

This will forward-line 4 times (4j), 4 times (.), 2 times (2.), 2
times (.).

Fixes #92

9 years agoDon't default `hydra-repeat--prefix-arg' to 1
Oleh Krehel [Wed, 25 Mar 2015 18:50:24 +0000 (19:50 +0100)]
Don't default `hydra-repeat--prefix-arg' to 1

* hydra.el (hydra-repeat): Update.

Re #61

9 years agoMention the leading newline in `defhydra' docstring
Oleh Krehel [Tue, 24 Mar 2015 17:43:38 +0000 (18:43 +0100)]
Mention the leading newline in `defhydra' docstring

* hydra.el (hydra--handle-switch-frame): Update doc.
(hydra--format): Update doc.
(hydra-timeout): Update doc.
(defhydra): Update doc.
(defhydradio): Update doc.

Fixes #88.

9 years agoFix argument to `replace-match'
Oleh Krehel [Tue, 24 Mar 2015 16:58:44 +0000 (17:58 +0100)]
Fix argument to `replace-match'

* hydra.el (hydra--format): Update.

* hydra-test.el (hydra-format-3): Add test.

Fixes #91

9 years agoFix blue/red heads with same cmd
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.

* hydra-test.el (hydra-blue-toggle): Update.
(hydra-amaranth-vi): Update.
(hydra-zoom-duplicate-1): Update.
(hydra-zoom-duplicate-2): Update.

Fixes #84

9 years agoAllow for the "%s`foo" spec.
Oleh Krehel [Mon, 23 Mar 2015 16:28:13 +0000 (17:28 +0100)]
Allow for the "%s`foo" spec.

* hydra.el (hydra--format): Update. Treat variables in the same way as
  s-expressions.

* hydra-test.el (hydra-format-2): Add test.
(hydra-format-with-sexp-2): Add test.

Fixes #85

9 years agohydra.el: Turn on lexical-binding
Oleh Krehel [Sun, 22 Mar 2015 16:42:53 +0000 (17:42 +0100)]
hydra.el: Turn on lexical-binding

* hydra.el (hydra-set-transient-map): Fix warning.
(hydra--head-color): Fix warning.
(hydra--hint): Update signature.
(hydra--format): Update.
(hydra--matrix): Fix warning.
(defhydra): Fix warning.
(defhydradio): Fix warning.

9 years agoMinor fixes
Oleh Krehel [Sun, 22 Mar 2015 16:26:55 +0000 (17:26 +0100)]
Minor fixes

* hydra.el (hydra--format): Save match data.
(hydra--handle-nonhead): Don't quote lambda.
(hydra--cycle-radio): Use cl-incf.

9 years agoSet pink/amaranth override recursively
Oleh Krehel [Sat, 21 Mar 2015 18:30:23 +0000 (19:30 +0100)]
Set pink/amaranth override recursively

* hydra.el (hydra--modify-keymap): New defun.
(hydra--handle-nonhead): Update.

Fixes #81.

9 years agohydra.el (hydra-keyboard-quit): Clean up the message area
Oleh Krehel [Sat, 21 Mar 2015 17:09:46 +0000 (18:09 +0100)]
hydra.el (hydra-keyboard-quit): Clean up the message area

* hydra.el (hydra-keyboard-quit): Update.

Fixes #80.

9 years agolv.el (lv-message): Use setq-local for window-min-height
Oleh Krehel [Fri, 20 Mar 2015 15:34:34 +0000 (16:34 +0100)]
lv.el (lv-message): Use setq-local for window-min-height

9 years agoCall :post for :timeout
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.

For this example code:

(global-set-key
 (kbd "C-c t")
 (defhydra test-hydra-b
     (:timeout 2.0 :post (message "test b quit"))
   "test b"
   ("x" (message "x"))
   ("y" (message "y"))
   ("q" nil "quit")))

The message "test b quit" is issued:

- on "q"

- 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.

- not on a plain "C-c t"

Fixes #34

9 years agoDon't bind `hydra-keyboard-quit' in foreign keymaps
Oleh Krehel [Fri, 20 Mar 2015 14:01:13 +0000 (15:01 +0100)]
Don't bind `hydra-keyboard-quit' in foreign keymaps

* hydra.el (defhydra): Update.

Fixes #78.

9 years agoAdd hydra-rectangle example
Oleh Krehel [Tue, 17 Mar 2015 17:38:44 +0000 (18:38 +0100)]
Add hydra-rectangle example

* hydra-examples.el (hydra-toggle-simple): Rename from `hydra-toggle'.
(hydra-rectangle): New hydra.

9 years agohydra-examples.el (hydra-apropos): Add.
Oleh Krehel [Sun, 15 Mar 2015 17:35:47 +0000 (18:35 +0100)]
hydra-examples.el (hydra-apropos): Add.

9 years agoFix switch-frame handling.
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'.

See #73

* hydra.el: Add `hydra--handle-switch-frame'

* hydra-test.el: Update

Fixes #77

9 years agohydra.el (hydra--format): Extend key regex with ";:"
Oleh Krehel [Fri, 13 Mar 2015 14:04:58 +0000 (15:04 +0100)]
hydra.el (hydra--format): Extend key regex with ";:"

Re #75

9 years agoBind [switch-frame] to `hydra-keyboard-quit'
Oleh Krehel [Thu, 12 Mar 2015 19:11:02 +0000 (20:11 +0100)]
Bind [switch-frame] to `hydra-keyboard-quit'

* hydra.el (hydra-base-map): Update.

* hydra-test.el: Update.

Fixes #73.

9 years agolv.el: Update truncation rules
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.

Re #40.

9 years agoREADME.md: Fix up typos
Oleh Krehel [Wed, 11 Mar 2015 18:11:33 +0000 (19:11 +0100)]
README.md: Fix up typos

9 years agoWiki link to the "Home" page instead.
hura [Wed, 11 Mar 2015 13:23:35 +0000 (09:23 -0400)]
Wiki link to the "Home" page instead.

9 years agoREADME.md: Add toc
Oleh Krehel [Wed, 11 Mar 2015 13:02:59 +0000 (14:02 +0100)]
README.md: Add toc

Re #71

9 years agoREADME.md: describe docstring
Oleh Krehel [Wed, 11 Mar 2015 12:58:30 +0000 (13:58 +0100)]
README.md: describe docstring

9 years agoREADME.md: finish up the rules
Oleh Krehel [Wed, 11 Mar 2015 12:43:34 +0000 (13:43 +0100)]
README.md: finish up the rules

9 years agoREADME.md: move some stuff to wiki, add more stuff
Oleh Krehel [Wed, 11 Mar 2015 12:19:26 +0000 (13:19 +0100)]
README.md: move some stuff to wiki, add more stuff

9 years agoREADME.md: update
Oleh Krehel [Wed, 11 Mar 2015 11:36:25 +0000 (12:36 +0100)]
README.md: update

9 years agohydra-examples.el (hydra-buffer-menu): Fix example
Oleh Krehel [Wed, 11 Mar 2015 11:21:52 +0000 (12:21 +0100)]
hydra-examples.el (hydra-buffer-menu): Fix example

9 years agoMakefile: Simplify
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.:

    make compile emacs=emacs24

Re #70.

9 years agohydra-examples.el: Fixup
Oleh Krehel [Wed, 11 Mar 2015 10:11:00 +0000 (11:11 +0100)]
hydra-examples.el: Fixup

9 years ago"C-g" (`hydra-keyboard-quit' ) should run :post
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.

* hydra-test.el (hydra-amaranth-vi): Update test.

Fixes #67.

9 years agoFix wrong type argument in hydra-timeout
Greg Lucas [Mon, 9 Mar 2015 00:40:22 +0000 (20:40 -0400)]
Fix wrong type argument in hydra-timeout

9 years agoUpdate `golden-ratio-mode' work-around
Oleh Krehel [Fri, 6 Mar 2015 18:39:02 +0000 (19:39 +0100)]
Update `golden-ratio-mode' work-around

* lv.el (lv-window): Update.
(lv-message): Update.

Re #64.

9 years agohydra-ox.el (hydra-ox): Update parameter list
Oleh Krehel [Fri, 6 Mar 2015 15:05:37 +0000 (16:05 +0100)]
hydra-ox.el (hydra-ox): Update parameter list

The `defhydradio' spec for each parameter was updated to:

    (name &optional doc value)

This way, it's easy to define this type of hydra:

(defhydradio hydra-tng ()
  (picard "_p_ Captain Jean Luc Picard:")
  (riker "_r_ Commander William Riker:")
  (data "_d_ Lieutenant Commander Data:")
  (worf "_w_ Worf:")
  (la-forge "_f_ Geordi La Forge:")
  (troi "_t_ Deanna Troi:")
  (dr-crusher "_c_ Doctor Beverly Crusher:")
  (phaser "_h_ Set phasers to " [stun kill]))

(defhydra hydra-tng (:color pink)
  (concat (hydra--table hydra-tng/names 7 2 '("  % -30s %% -3`%s" "%s %%`%s"))
          "\n\n")
  ("p" (hydra-tng/picard) nil)
  ("r" (hydra-tng/riker) nil)
  ("d" (hydra-tng/data) nil)
  ("w" (hydra-tng/worf) nil)
  ("f" (hydra-tng/la-forge) nil)
  ("t" (hydra-tng/troi) nil)
  ("c" (hydra-tng/dr-crusher) nil)
  ("h" (hydra-tng/phaser) nil)
  ("b" beam-down "beam down" :exit t)
  ("o" (hydra-reset-radios hydra-tng/names) "reset")
  ("q" nil "cancel"))

9 years agoAdd option to specify :hint in body
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.

Example:

(defhydra hydra-org-template (:color blue :hint nil)
  "
_c_enter  _q_uote    _L_aTeX:
_l_atex   _e_xample  _i_ndex:
_a_scii   _v_erse    _I_NCLUDE:
_s_rc     ^ ^        _H_TML:
_h_tml    ^ ^        _A_SCII:
"
  ("s" (hot-expand "<s"))
  ("e" (hot-expand "<e"))
  ("q" (hot-expand "<q"))
  ("v" (hot-expand "<v"))
  ("c" (hot-expand "<c"))
  ("l" (hot-expand "<l"))
  ("h" (hot-expand "<h"))
  ("a" (hot-expand "<a"))
  ("L" (hot-expand "<L"))
  ("i" (hot-expand "<i"))
  ("I" (hot-expand "<I"))
  ("H" (hot-expand "<H"))
  ("A" (hot-expand "<A"))
  ("<" self-insert-command "ins")
  ("o" nil "quit"))

Some setup:

(defun hot-expand (str)
  "Expand org template."
  (insert str)
  (org-try-structure-completion))
(define-key org-mode-map "<"
  (lambda () (interactive)
     (if (looking-back "^")
         (hydra-org-template/body)
       (self-insert-command 1))))

9 years agohydra-ox.el: Emulate org-mode export dispatch
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.

Re #66.

9 years agoAllow for a %s(test) spec in docstring
Oleh Krehel [Wed, 4 Mar 2015 16:34:42 +0000 (17:34 +0100)]
Allow for a %s(test) spec in docstring

* hydra.el (hydra-set-transient-map): Avoid compiler warnings.
(hydra--format): Add s? to regex.

- %(test) will translate to (format "%S" (test))
- %s(test) will translate to (format "%s" (test))

The width specifiers should work for both, e.g. % -10(test) or %
-10s(test).

Example:

(defhydra hydra-marked-items (dired-mode-map "")
  "
Number of marked items: %(length (dired-get-marked-files))
Directory size: %s(shell-command-to-string \"du -hs\")
"
  ("m" dired-mark "mark"))

Fixes #65.

9 years agolv.el (lv-window): Bind `golden-ratio-mode' to nil
Oleh Krehel [Wed, 4 Mar 2015 14:37:14 +0000 (15:37 +0100)]
lv.el (lv-window): Bind `golden-ratio-mode' to nil

Re #64.

9 years agoAdd :timeout option to hydra body
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.

Re #34.

9 years agohydra.el (hydra--format): Amend key regex
hura [Sat, 28 Feb 2015 01:01:57 +0000 (20:01 -0500)]
hydra.el (hydra--format): Amend key regex

Recognize the '{' and '}' keys.

9 years agoDon't wrap `hydra-repeat'
Oleh Krehel [Fri, 27 Feb 2015 19:32:09 +0000 (20:32 +0100)]
Don't wrap `hydra-repeat'

* hydra.el (hydra--delete-duplicates): Update.
(hydra--vconcat): Trim trailing spaces.

* hydra-test.el (hydra-red-error): Update test.
(hydra--table): Update test.

9 years agoAdd some features for generating tables
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.

* hydra-test.el (defhydradio): Update test.
(hydra--pad): Add test.
(hydra--matrix): Add test.
(hydra--cell): Add test.
(hydra--vconcat): Add test.
(hydra--table): Add test.

9 years agoAdd `hydra-repeat': hydra-specific `repeat'
Oleh Krehel [Fri, 27 Feb 2015 12:15:13 +0000 (13:15 +0100)]
Add `hydra-repeat': hydra-specific `repeat'

* hydra.el (hydra-repeat): New defun.
(hydra-repeat--command): New defvar.
(hydra-repeat--prefix-arg): New defvar.

Example:

(defhydra hydra-vi ()
  "vi"
  ("h" backward-char)
  ("j" next-line)
  ("k" previous-line)
  ("l" forward-char)
  ("." hydra-repeat))
(global-set-key (kbd "C-v") 'hydra-vi/body)

"C-v 4l.." will result in movement forward by 4 chars 3 times: first
time from "4l", the other two from "..".

Fixes #59.

9 years agohydra.el (hydra--format): Amend key regex
François Févotte [Thu, 26 Feb 2015 15:43:34 +0000 (11:43 -0400)]
hydra.el (hydra--format): Amend key regex

Recognize the '=' key.

9 years agohydra.el (hydra-key-format-spec): set default to "%s"
Oleh Krehel [Wed, 25 Feb 2015 15:56:19 +0000 (16:56 +0100)]
hydra.el (hydra-key-format-spec): set default to "%s"

* hydra-test.el (hydra-format): Update test.
(hydra-format-with-sexp): Update test.