[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 566aab7 31/45: Set `this-command' when appropriate
From: |
Oleh Krehel |
Subject: |
[elpa] master 566aab7 31/45: Set `this-command' when appropriate |
Date: |
Thu, 16 Apr 2015 12:45:52 +0000 |
branch: master
commit 566aab77e92e98f6ca317a9a6646e219b2ef85c7
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Set `this-command' when appropriate
* hydra.el (hydra--make-defun): Update.
* hydra-test.el: Update tests.
Re #79
---
hydra-test.el | 32 ++++++++++++++++++++++++--------
hydra.el | 9 ++++++---
2 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/hydra-test.el b/hydra-test.el
index a8facfe..28b4519 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -121,7 +121,9 @@ Call the head: `first-error'."
(lambda nil
(hydra-keyboard-quit)
nil)
- nil))
+ nil)
+ (setq this-command
+ (quote first-error)))
(defun hydra-error/next-error nil
"Create a hydra with a \"M-g\" body and the heads:
@@ -152,7 +154,9 @@ Call the head: `next-error'."
(lambda nil
(hydra-keyboard-quit)
nil)
- nil))
+ nil)
+ (setq this-command
+ (quote next-error)))
(defun hydra-error/previous-error nil
"Create a hydra with a \"M-g\" body and the heads:
@@ -183,7 +187,9 @@ Call the head: `previous-error'."
(lambda nil
(hydra-keyboard-quit)
nil)
- nil))
+ nil)
+ (setq this-command
+ (quote previous-error)))
(unless (keymapp
(lookup-key
global-map
@@ -311,7 +317,9 @@ Call the head: `toggle-truncate-lines'."
(hydra-keyboard-quit)
(call-interactively
(function
- toggle-truncate-lines)))
+ toggle-truncate-lines))
+ (setq this-command
+ (quote toggle-truncate-lines)))
(defun hydra-toggle/auto-fill-mode-and-exit nil
"Create a hydra with no body and the heads:
@@ -327,7 +335,9 @@ Call the head: `auto-fill-mode'."
(hydra-default-pre)
(hydra-keyboard-quit)
(call-interactively
- (function auto-fill-mode)))
+ (function auto-fill-mode))
+ (setq this-command
+ (quote auto-fill-mode)))
(defun hydra-toggle/abbrev-mode-and-exit nil
"Create a hydra with no body and the heads:
@@ -343,7 +353,9 @@ Call the head: `abbrev-mode'."
(hydra-default-pre)
(hydra-keyboard-quit)
(call-interactively
- (function abbrev-mode)))
+ (function abbrev-mode))
+ (setq this-command
+ (quote abbrev-mode)))
(defun hydra-toggle/nil nil
"Create a hydra with no body and the heads:
@@ -480,7 +492,9 @@ Call the head: `next-line'."
(lambda nil
(hydra-keyboard-quit)
(set-cursor-color "#ffffff"))
- (quote warn)))
+ (quote warn))
+ (setq this-command
+ (quote next-line)))
(defun hydra-vi/previous-line nil
"Create a hydra with no body and the heads:
@@ -510,7 +524,9 @@ Call the head: `previous-line'."
(lambda nil
(hydra-keyboard-quit)
(set-cursor-color "#ffffff"))
- (quote warn)))
+ (quote warn))
+ (setq this-command
+ (quote previous-line)))
(defun hydra-vi/nil nil
"Create a hydra with no body and the heads:
diff --git a/hydra.el b/hydra.el
index 57a78fc..e002c8a 100644
--- a/hydra.el
+++ b/hydra.el
@@ -566,7 +566,10 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
(list 'quote body-foreign-keys)))
,body-after-exit
,(when body-timeout
- `(hydra-timeout ,body-timeout))))))))
+ `(hydra-timeout ,body-timeout)))))
+ ,@(when (and (symbolp (cadr head))
+ (not (memq (cadr head) '(nil body))))
+ `((setq this-command ',(cadr head)))))))
(defmacro hydra--make-funcall (sym)
"Transform SYM into a `funcall' to call it."
@@ -779,8 +782,6 @@ result of `defhydra'."
(body-inherit (plist-get body-plist :inherit))
(body-foreign-keys (hydra--body-foreign-keys body))
(body-exit (hydra--body-exit body)))
- (hydra--make-funcall body-before-exit)
- (hydra--make-funcall body-after-exit)
(dolist (base body-inherit)
(setq heads (append heads (copy-sequence (eval base)))))
(dolist (h heads)
@@ -827,6 +828,8 @@ result of `defhydra'."
heads)
(hydra--make-funcall body-pre)
(hydra--make-funcall body-body-pre)
+ (hydra--make-funcall body-before-exit)
+ (hydra--make-funcall body-after-exit)
(when (memq body-foreign-keys '(run warn))
(unless (cl-some
(lambda (h)
- [elpa] master 5787a4d 13/45: Move away from setting "t" in keymaps, (continued)
- [elpa] master 5787a4d 13/45: Move away from setting "t" in keymaps, Oleh Krehel, 2015/04/16
- [elpa] master 5379642 06/45: Use `hydra-keyboard-quit' instead of `hydra-cleanup', Oleh Krehel, 2015/04/16
- [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 <=
- [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, 2015/04/16
- [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