]> code.delx.au - gnu-emacs-elpa/log
gnu-emacs-elpa
8 years agoAdd .elpaignore
Oleh Krehel [Fri, 4 Mar 2016 19:57:06 +0000 (20:57 +0100)]
Add .elpaignore

Fixes #182

8 years agohydra-examples.el (rect): Add require
Oleh Krehel [Tue, 26 Jan 2016 08:57:01 +0000 (09:57 +0100)]
hydra-examples.el (rect): Add require

8 years agoUse set+make-local-variable instead of setq-local for older versions(<24.3)
Syohei YOSHIDA [Tue, 26 Jan 2016 07:33:50 +0000 (16:33 +0900)]
Use set+make-local-variable instead of setq-local for older versions(<24.3)

8 years agohydra-examples.el (hydra-rectangle): Use better commands
Oleh Krehel [Mon, 25 Jan 2016 08:13:47 +0000 (09:13 +0100)]
hydra-examples.el (hydra-rectangle): Use better commands

8 years agoAllow e.g. "_M-\\^_" in docstrings
Oleh Krehel [Mon, 25 Jan 2016 08:12:42 +0000 (09:12 +0100)]
Allow e.g. "_M-\\^_" in docstrings

* hydra.el (hydra--format): Update regexp. Warn instead of error on
  unrecognized keys.

Fixes #178

8 years agoFix unbind of key-chord when hydra is active
Oleh Krehel [Mon, 14 Dec 2015 12:17:01 +0000 (13:17 +0100)]
Fix unbind of key-chord when hydra is active

* hydra.el (hydra-disable): Don't remove advice on
  `input-method-function' unless `hydra--ignore' is nil.

Fixes #97

8 years agoFix byte-compiler warning
Oleh Krehel [Tue, 8 Dec 2015 09:22:43 +0000 (10:22 +0100)]
Fix byte-compiler warning

8 years agohydra-ox.el: Add a require hydra
Jonas Bernoulli [Fri, 30 Oct 2015 19:03:40 +0000 (20:03 +0100)]
hydra-ox.el: Add a require hydra

8 years agohydra.el (hydra-disable): Call the exit action only in one frame
Oleh Krehel [Fri, 30 Oct 2015 12:53:27 +0000 (13:53 +0100)]
hydra.el (hydra-disable): Call the exit action only in one frame

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

8 years agohydra-test.el: Add a require hydra
Oleh Krehel [Fri, 30 Oct 2015 09:45:32 +0000 (10:45 +0100)]
hydra-test.el: Add a require hydra

8 years agoAllow head-hint to be dynamic
Oleh Krehel [Mon, 19 Oct 2015 09:29:01 +0000 (11:29 +0200)]
Allow head-hint to be dynamic

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

8 years agoFix failing test on Emacs 25
Oleh Krehel [Fri, 16 Oct 2015 10:23:09 +0000 (12:23 +0200)]
Fix failing test on Emacs 25

8 years agoBump version
Oleh Krehel [Fri, 16 Oct 2015 10:05:35 +0000 (12:05 +0200)]
Bump version

8 years agohydra.el (hydra-disable): Deactivate key-chord advice more
Oleh Krehel [Tue, 1 Sep 2015 09:26:21 +0000 (11:26 +0200)]
hydra.el (hydra-disable): Deactivate key-chord advice more

* 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

8 years agoAllow "_", "!", and "&" as keys in docstrings
Oleh Krehel [Sun, 30 Aug 2015 07:35:17 +0000 (09:35 +0200)]
Allow "_", "!", and "&" as keys in docstrings

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

Fixes #161

8 years agohydra.el (hydra--format): Allow "@" key in the docs
Oleh Krehel [Wed, 12 Aug 2015 05:52:51 +0000 (07:52 +0200)]
hydra.el (hydra--format): Allow "@" key in the docs

Fixes #158

8 years agoAllow #'command syntax for heads, just to have it
Oleh Krehel [Thu, 6 Aug 2015 06:17:23 +0000 (08:17 +0200)]
Allow #'command syntax for heads, just to have it

* 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

8 years agoDeclare dired-mark to silence byte-compiler
Jonas Bernoulli [Wed, 5 Aug 2015 15:45:33 +0000 (17:45 +0200)]
Declare dired-mark to silence byte-compiler

8 years agoMake find-function work with defhydra
Oleh Krehel [Sun, 2 Aug 2015 12:38:31 +0000 (14:38 +0200)]
Make find-function work with defhydra

* hydra.el (find-function-search-for-symbol): New defadvice.

Fixes #153

8 years agoUse quote instead of function to prevent compiler warnings
Oleh Krehel [Thu, 23 Jul 2015 08:54:50 +0000 (10:54 +0200)]
Use quote instead of function to prevent compiler warnings

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

8 years agoAllow to specify :face for each head
Oleh Krehel [Tue, 21 Jul 2015 17:41:42 +0000 (19:41 +0200)]
Allow to specify :face for each head

* hydra.el (hydra-fontify-head-default): Update - :face will override
  any previously calculated face (red/blue/pink...).

Example:

(defface hydra-face-orange
    '((t (:foreground "orange" :bold t)))
  "Orange face. For fun.")

(defhydra hydra-projectile (:color blue
                            :columns 4)
  "Projectile"
  ("a" projectile-ag "ag" :face 'hydra-face-orange)
  ("b" projectile-switch-to-buffer "switch to buffer")
  ("c" projectile-invalidate-cache "cache clear")
  ("d" projectile-find-dir "dir")
  ("s-f" projectile-find-file "file")
  ("ff" projectile-find-file-dwim "file dwim")
  ("fd" projectile-find-file-in-directory "file curr dir")
  ("g" ggtags-update-tags "update gtags")
  ("i" projectile-ibuffer "Ibuffer")
  ("K" projectile-kill-buffers "Kill all buffers")
  ("o" projectile-multi-occur "multi-occur")
  ("p" projectile-switch-project "switch")
  ("r" projectile-recentf "recent file")
  ("x" projectile-remove-known-project "remove known")
  ("X" projectile-cleanup-known-projects "cleanup non-existing")
  ("z" projectile-cache-current-file "cache current")
  ("q" nil "cancel"))

8 years agoRemove trailing whitespace from :columns docstring
Oleh Krehel [Tue, 21 Jul 2015 10:45:56 +0000 (12:45 +0200)]
Remove trailing whitespace from :columns docstring

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

* hydra-test.el (hydra-columns-1): Update.

Fixes #146

8 years agoAdd :columns option for hydra body
Oleh Krehel [Mon, 20 Jul 2015 11:34:21 +0000 (13:34 +0200)]
Add :columns option for hydra body

* 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

8 years agohydra.el (hydra-head-format): Customize the key formatting
Oleh Krehel [Sun, 19 Jul 2015 16:08:37 +0000 (18:08 +0200)]
hydra.el (hydra-head-format): Customize the key formatting

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

8 years agoAllow binding heads to "%"
Oleh Krehel [Sat, 18 Jul 2015 16:20:23 +0000 (18:20 +0200)]
Allow binding heads to "%"

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

8 years agoAllow for "_[_" and "_]_" in docs
Oleh Krehel [Fri, 17 Jul 2015 18:31:35 +0000 (20:31 +0200)]
Allow for "_[_" and "_]_" in docs

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

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

Fixes #143

8 years agotargets/hydra-init.el: Move
Oleh Krehel [Tue, 7 Jul 2015 07:35:00 +0000 (09:35 +0200)]
targets/hydra-init.el: Move

* Makefile: Update.

Fixes #139

8 years agoAllow to pause arbitrary hydras to the stack
Oleh Krehel [Wed, 24 Jun 2015 09:03:03 +0000 (11:03 +0200)]
Allow to pause arbitrary hydras to the stack

* 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

8 years agohydra.el (hydra-face-blue): Customize for dark themes
Oleh Krehel [Tue, 23 Jun 2015 14:28:44 +0000 (16:28 +0200)]
hydra.el (hydra-face-blue): Customize for dark themes

8 years agoAllow access to the current hydra body
Oleh Krehel [Tue, 19 May 2015 16:50:32 +0000 (18:50 +0200)]
Allow access to the current hydra body

* 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

8 years agolv-window: split-window ignores window parameters
Jan Tatarik [Tue, 19 May 2015 20:46:54 +0000 (22:46 +0200)]
lv-window: split-window ignores window parameters

fix lv-window failure in presence of a bottom window with
no-other-window window parameter set to t

9 years agohydra.el (hydra-fontify-head-default): Add "%" exception
Oleh Krehel [Wed, 13 May 2015 05:25:41 +0000 (07:25 +0200)]
hydra.el (hydra-fontify-head-default): Add "%" exception

* hydra.el (hydra--hint): Simplify.

Fixes #126

9 years agoAllow to escape ^ in docstrings
Oleh Krehel [Tue, 12 May 2015 07:39:57 +0000 (09:39 +0200)]
Allow to escape ^ in docstrings

* 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

9 years agohydra.el: Bump version
Oleh Krehel [Fri, 1 May 2015 13:46:21 +0000 (15:46 +0200)]
hydra.el: Bump version

9 years agohydra.el: Use add/remove-function. Fix warning.
Stefan Monnier [Sun, 19 Apr 2015 20:00:53 +0000 (16:00 -0400)]
hydra.el: Use add/remove-function. Fix warning.

* hydra.el (hydra--input-method-function): Move before first use.
(hydra--imf): New function.
(hydra-default-pre, hydra-disable): Use add/remove-function.

9 years agohydra.el (hydra-cell-format): Change to defvar
Oleh Krehel [Thu, 30 Apr 2015 08:55:13 +0000 (10:55 +0200)]
hydra.el (hydra-cell-format): Change to defvar

9 years agohydra.el (hydra-key-format-spec): Declare obsolete
Oleh Krehel [Thu, 30 Apr 2015 08:55:00 +0000 (10:55 +0200)]
hydra.el (hydra-key-format-spec): Declare obsolete

9 years agohydra.el (hydra-fontify-head-default): Fixup
Oleh Krehel [Thu, 30 Apr 2015 08:18:56 +0000 (10:18 +0200)]
hydra.el (hydra-fontify-head-default): Fixup

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

9 years agoRepurpose `hydra--complain' for debugging
Oleh Krehel [Thu, 30 Apr 2015 08:11:56 +0000 (10:11 +0200)]
Repurpose `hydra--complain' for debugging

hydra.el (hydra--complain): Forward to either `error' or `message'.

* lv.el (lv-use-separator): Fixup doc.

9 years agoMake *LV* window fixed size
Oleh Krehel [Thu, 30 Apr 2015 07:44:12 +0000 (09:44 +0200)]
Make *LV* window fixed size

* 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

9 years agoAdd a work-around for pop-to-buffer / dedicated bug
Oleh Krehel [Tue, 28 Apr 2015 16:40:00 +0000 (18:40 +0200)]
Add a work-around for pop-to-buffer / dedicated bug

* hydra.el (hydra--work-around-dedicated): New defvar.
(hydra-keyboard-quit): Update.

Fixes #124
Fixes #119

9 years agolv.el (lv-message): Use `lv-use-separator'
Oleh Krehel [Tue, 28 Apr 2015 07:50:10 +0000 (09:50 +0200)]
lv.el (lv-message): Use `lv-use-separator'

* lv.el (lv-message): Check `lv-use-separator' and use `looking-back'.

Fixes #123.

9 years agolv.el (lv-force-update): Be nil by default
Oleh Krehel [Tue, 28 Apr 2015 07:49:45 +0000 (09:49 +0200)]
lv.el (lv-force-update): Be nil by default

9 years ago.dir-locals.el: Add
Oleh Krehel [Mon, 27 Apr 2015 12:31:50 +0000 (14:31 +0200)]
.dir-locals.el: Add

9 years agoOptionally separate lv window and echo area using a thin line
Jonas Bernoulli [Sun, 26 Apr 2015 18:38:46 +0000 (20:38 +0200)]
Optionally separate lv window and echo area using a thin line

* lv.el (lv-use-separator): New option.
(lv-separator): New face.
(lv): New custom group.
(lv-message): Respect lv-use-separator using lv-separator.

Re #122

9 years agoAdd lv-force-update
Oleh Krehel [Sun, 26 Apr 2015 07:21:52 +0000 (09:21 +0200)]
Add lv-force-update

* hydra.el (hydra-keyboard-quit): Don't clear the message when
  `hydra--ignore' is t.

* lv.el (lv-force-update): New defvar.
(lv-message): Refresh the window unless both the window contents haven't
changed and `lv-force-update' is nil.

Fixes #121

9 years agoUse one less ; for local vars
Oleh Krehel [Sat, 25 Apr 2015 11:32:49 +0000 (13:32 +0200)]
Use one less ; for local vars

9 years agoUpdate `outline-regexp' and `indent-tabs-mode' file locals
Oleh Krehel [Sat, 25 Apr 2015 11:28:06 +0000 (13:28 +0200)]
Update `outline-regexp' and `indent-tabs-mode' file locals

Re #120

9 years agoAdd `lv-delete-window' function
Jonas Bernoulli [Sat, 25 Apr 2015 11:03:23 +0000 (13:03 +0200)]
Add `lv-delete-window' function

* lv.el (lv-delete-window): New defun.
* hydra.el (hydra-keyboard-quit): Use it.

9 years agoFix the regex once more and add test
Oleh Krehel [Sat, 25 Apr 2015 11:06:54 +0000 (13:06 +0200)]
Fix the regex once more and add test

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

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

Fixes #117

9 years agohydra.el (hydra-face-teal): Fixup doc
Oleh Krehel [Thu, 23 Apr 2015 21:01:44 +0000 (23:01 +0200)]
hydra.el (hydra-face-teal): Fixup doc

9 years agohydra.el (hydra--format): Be non-greedy with width spec
Oleh Krehel [Thu, 23 Apr 2015 19:48:26 +0000 (21:48 +0200)]
hydra.el (hydra--format): Be non-greedy with width spec

* hydra.el (hydra--format): Since the key spec is non-greedy, the width
  spec should be non-greedy too.

Otherwise, the following will match more than _1_:
    _1_: h1         _2_: h2

Fixes #117

9 years agoMatch e.g. "C-d C-o" in docstring
Oleh Krehel [Thu, 23 Apr 2015 13:53:02 +0000 (15:53 +0200)]
Match e.g. "C-d C-o" in docstring

* hydra.el (hydra--format): Allow space; make the regex non-greedy.

Fixes #116

9 years agoAllow heads to conditionally exit
Oleh Krehel [Thu, 23 Apr 2015 09:10:32 +0000 (11:10 +0200)]
Allow heads to conditionally exit

* hydra.el (hydra-deactivate): New defvar.
(hydra-set-transient-map): When `hydra-deactivate' is set, quit.
(hydra-disable): Make sure that `hydra-deactivate' is reset back to nil.

Fixes #115

Example: zoom in at most 5 times, then quit.

(defvar hydra-zoom-amount 1)

(defhydra hydra-zoom (global-map "<f2>")
  "zoom"
  ("g"
   (if (>= hydra-zoom-amount 5)
       (progn
         (setq hydra-zoom-amount 1)
         (setq hydra-deactivate t))
     (cl-incf hydra-zoom-amount)
     (call-interactively 'text-scale-increase))
   "in")
  ("l" text-scale-decrease "out"))

9 years agohydra-examples.el: Add a defvar
Oleh Krehel [Mon, 20 Apr 2015 09:59:18 +0000 (11:59 +0200)]
hydra-examples.el: Add a defvar

9 years agohydra.el (hydra--input-method-function): Move before first use
Oleh Krehel [Sat, 18 Apr 2015 17:12:02 +0000 (19:12 +0200)]
hydra.el (hydra--input-method-function): Move before first use

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.