[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 986226f 18/45: Simplify `keyboard-quit'
From: |
Oleh Krehel |
Subject: |
[elpa] master 986226f 18/45: Simplify `keyboard-quit' |
Date: |
Thu, 16 Apr 2015 12:45:46 +0000 |
branch: master
commit 986226f8652743881d282bd2de81b7bc11ddaf31
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
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'.
---
hydra-test.el | 33 +++++----------------------------
hydra.el | 14 ++------------
2 files changed, 7 insertions(+), 40 deletions(-)
diff --git a/hydra-test.el b/hydra-test.el
index 0ac6a8f..9fe3fb1 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -45,7 +45,6 @@
(107 . hydra-error/previous-error)
(106 . hydra-error/next-error)
(104 . hydra-error/first-error)
- (7 . hydra-keyboard-quit)
(kp-subtract . hydra--negative-argument)
(kp-9 . hydra--digit-argument)
(kp-8 . hydra--digit-argument)
@@ -221,7 +220,6 @@ The body can be accessed via `hydra-error/body'."
(97 . hydra-toggle/abbrev-mode-and-exit)
(102 . hydra-toggle/auto-fill-mode-and-exit)
(116 . hydra-toggle/toggle-truncate-lines-and-exit)
- (7 . hydra-keyboard-quit)
(kp-subtract . hydra--negative-argument)
(kp-9 . hydra--digit-argument)
(kp-8 . hydra--digit-argument)
@@ -368,7 +366,6 @@ The body can be accessed via `hydra-toggle/body'."
(quote (keymap (113 . hydra-vi/nil)
(107 . hydra-vi/previous-line)
(106 . hydra-vi/next-line)
- (7 . hydra-vi/hydra-keyboard-quit-and-exit)
(kp-subtract . hydra--negative-argument)
(kp-9 . hydra--digit-argument)
(kp-8 . hydra--digit-argument)
@@ -392,27 +389,9 @@ The body can be accessed via `hydra-toggle/body'."
(48 . hydra--digit-argument)
(45 . hydra--negative-argument)
(21 . hydra--universal-argument))))
- (defun hydra-vi/hydra-keyboard-quit-and-exit nil
- "Create a hydra with no body and the heads:
-
-\"\": `hydra-keyboard-quit',
-\"j\": `next-line',
-\"k\": `previous-line',
-\"q\": `nil'
-
-The body can be accessed via `hydra-vi/body'.
-
-Call the head: `hydra-keyboard-quit'."
- (interactive)
- (hydra-default-pre)
- (set-cursor-color "#e52b50")
- (hydra-keyboard-quit)
- (call-interactively
- (function hydra-keyboard-quit)))
(defun hydra-vi/next-line nil
"Create a hydra with no body and the heads:
-\"\": `hydra-keyboard-quit',
\"j\": `next-line',
\"k\": `previous-line',
\"q\": `nil'
@@ -440,7 +419,6 @@ Call the head: `next-line'."
(defun hydra-vi/previous-line nil
"Create a hydra with no body and the heads:
-\"\": `hydra-keyboard-quit',
\"j\": `next-line',
\"k\": `previous-line',
\"q\": `nil'
@@ -468,7 +446,6 @@ Call the head: `previous-line'."
(defun hydra-vi/nil nil
"Create a hydra with no body and the heads:
-\"\": `hydra-keyboard-quit',
\"j\": `next-line',
\"k\": `previous-line',
\"q\": `nil'
@@ -498,7 +475,6 @@ Call the head: `nil'."
(defun hydra-vi/body nil
"Create a hydra with no body and the heads:
-\"\": `hydra-keyboard-quit',
\"j\": `next-line',
\"k\": `previous-line',
\"q\": `nil'
@@ -532,7 +508,6 @@ The body can be accessed via `hydra-vi/body'."
(defvar hydra-zoom/keymap nil
"Keymap for hydra-zoom.")
(quote (keymap (114 . hydra-zoom/lambda-r)
- (7 . hydra-keyboard-quit)
(kp-subtract . hydra--negative-argument)
(kp-9 . hydra--digit-argument)
(kp-8 . hydra--digit-argument)
@@ -650,7 +625,6 @@ The body can be accessed via `hydra-zoom/body'."
(defvar hydra-zoom/keymap nil
"Keymap for hydra-zoom.")
(quote (keymap (114 . hydra-zoom/lambda-r)
- (7 . hydra-keyboard-quit)
(kp-subtract . hydra--negative-argument)
(kp-9 . hydra--digit-argument)
(kp-8 . hydra--digit-argument)
@@ -1122,8 +1096,11 @@ _w_ Worf: % -8`hydra-tng/worf^^
_h_ Set phasers to
(kbd "C-c aabbaaqaabbaa")))
"jjkkjjaabbaa|"))
(should (string= (hydra-with "|"
- (execute-kbd-macro
- (kbd "C-c aabb C-g aaqaabbaa")))
+ (condition-case nil
+ (execute-kbd-macro
+ (kbd "C-c aabb C-g"))
+ (quit nil))
+ (execute-kbd-macro "aaqaabbaa"))
"jjkkaaqaabbaa|")))
(provide 'hydra-test)
diff --git a/hydra.el b/hydra.el
index 502b6a8..c9ef2da 100644
--- a/hydra.el
+++ b/hydra.el
@@ -107,7 +107,8 @@ warn: keep KEYMAP and issue a warning instead of running
the command."
(defun hydra--clearfun ()
"Disable the current Hydra unless `this-command' is a head."
- (if (eq this-command 'handle-switch-frame)
+ (if (memq this-command '(handle-switch-frame
+ keyboard-quit))
(hydra-disable)
(unless (eq this-command
(lookup-key hydra-curr-map (this-command-keys-vector)))
@@ -163,11 +164,6 @@ warn: keep KEYMAP and issue a warning instead of running
the command."
:type 'boolean
:group 'hydra)
-(defcustom hydra-keyboard-quit ""
- "This binding will quit an amaranth Hydra.
-It's the only other way to quit it besides though a blue head.
-It's possible to set this to nil.")
-
(defcustom hydra-lv t
"When non-nil, `lv-message' (not `message') will be used to display hints."
:type 'boolean)
@@ -814,11 +810,6 @@ result of `defhydra'."
(body-post (plist-get body-plist :post))
(body-color (hydra--body-color body)))
(hydra--make-funcall body-post)
- (when hydra-keyboard-quit
- (if body-post
- (setq heads (cons (list hydra-keyboard-quit #'hydra-keyboard-quit
nil :exit t)
- heads))
- (define-key keymap hydra-keyboard-quit #'hydra-keyboard-quit)))
(dolist (h heads)
(let ((len (length h)))
(cond ((< len 2)
@@ -885,7 +876,6 @@ result of `defhydra'."
(lambda (head)
(let ((name (hydra--head-property head :cmd-name)))
(when (and (cadr head)
- (not (eq (cadr head) 'hydra-keyboard-quit))
(or body-key body-map))
(let ((bind (hydra--head-property head :bind body-map))
(final-key
- [elpa] master e88839c 17/45: Don't double-call :post, (continued)
- [elpa] master e88839c 17/45: Don't double-call :post, Oleh Krehel, 2015/04/16
- [elpa] master 2f07e50 26/45: Account for digit argument, Oleh Krehel, 2015/04/16
- [elpa] master 8875bf1 28/45: Make digit and negative arguments work in 24.3, Oleh Krehel, 2015/04/16
- [elpa] master 0ae639f 22/45: Use a variable instead of a function for the hint, Oleh Krehel, 2015/04/16
- [elpa] master d71386b 29/45: hydra.el (hydra--head-color): Simplify, Oleh Krehel, 2015/04/16
- [elpa] master 22348d7 23/45: hydra.el (hydra--face): Remove, Oleh Krehel, 2015/04/16
- [elpa] master 88f14a0 30/45: hydra.el (hydra--head-color): Remove, Oleh Krehel, 2015/04/16
- [elpa] master cb630df 16/45: Update the tests for the new `hydra-set-transient-map', Oleh Krehel, 2015/04/16
- [elpa] master 566aab7 31/45: Set `this-command' when appropriate, Oleh Krehel, 2015/04/16
- [elpa] master 19cc1be 21/45: Use `unwind-protect' for :after-exit, Oleh Krehel, 2015/04/16
- [elpa] master 986226f 18/45: Simplify `keyboard-quit',
Oleh Krehel <=
- [elpa] master 51e7753 19/45: Alias :post to :before-exit, and add :after-exit, Oleh Krehel, 2015/04/16
- [elpa] master 3d7d8c7 20/45: Add basic error handling, Oleh Krehel, 2015/04/16
- [elpa] master 684f8a2 39/45: Add integration test for red hydras temporarily exiting, Oleh Krehel, 2015/04/16
- [elpa] master d3d435d 25/45: Finalize head inheritance, Oleh Krehel, 2015/04/16
- [elpa] master b2c9ea6 36/45: README.md: Update intro, Oleh Krehel, 2015/04/16
- [elpa] master d678cc0 34/45: Work around `overriding-terminal-local-map' being terminal-local, Oleh Krehel, 2015/04/16
- [elpa] master d6e00ed 33/45: README.md: Add video demo link, Oleh Krehel, 2015/04/16
- [elpa] master 97c9b9b 32/45: Move `this-command' setter, Oleh Krehel, 2015/04/16
- [elpa] master 60ce256 41/45: Add an idle message timeout option, Oleh Krehel, 2015/04/16
- [elpa] master 99b2aea 35/45: hydra.el (hydra--format): Match alnum for the "_..._" syntax, Oleh Krehel, 2015/04/16