[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/keycast f3509489f2 2/6: keycast--update: Fix special-handl
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/keycast f3509489f2 2/6: keycast--update: Fix special-handling of execute-extended-command |
Date: |
Tue, 16 Jan 2024 16:00:10 -0500 (EST) |
branch: elpa/keycast
commit f3509489f279d5756ad3662eaad7e049c5397e92
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
keycast--update: Fix special-handling of execute-extended-command
---
keycast.el | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/keycast.el b/keycast.el
index a43f3ea5b2..95c42e36fa 100644
--- a/keycast.el
+++ b/keycast.el
@@ -347,23 +347,24 @@ t to show the actual COMMAND, or a symbol to be shown
instead."
(defun keycast--update ()
(let ((key (this-single-command-keys))
(cmd this-command))
- (when (and keycast--minibuffer-exited
- (or (not (equal key []))
- (not (eq this-original-command 'execute-extended-command))))
- ;; Show the command that exited the minibuffer instead of
- ;; once more showing the command that used the minibuffer.
+ (cond
+ ;; Special handling for `execute-extended-command'.
+ ((eq this-original-command 'execute-extended-command)
+ ;; Instead of "M-x t h e - c o m m a n d RET", just use
+ ;; "M-x", because we follow that up with the command anyway.
+ (setq key [?\M-x]))
+ ;; If a command uses the minibuffer then `post-command-hook'
+ ;; gets called twice on behalf of that command:
+ ((equal key [])
+ ;; 1. When the minibuffer is entered. The key is void in that
+ ;; case, which allows us to detect that it is the first call,
+ ;; but also means we have to get the actual key like this.
+ (setq key (this-single-command-raw-keys)))
+ (keycast--minibuffer-exited
+ ;; 2. When the minibuffer is exited (unless it is aborted).
(setq key (car keycast--minibuffer-exited))
- (setq cmd (cdr keycast--minibuffer-exited)))
+ (setq cmd (cdr keycast--minibuffer-exited))))
(setq keycast--minibuffer-exited nil)
- (when (or
- ;; If a command uses the minibuffer, then
- ;; `post-command-hook' gets called twice (unless the
- ;; minibuffer is aborted). This is the first call.
- (equal key [])
- ;; `execute-extended-command' intentionally corrupts
- ;; the value returned by `this-single-command-keys'.
- (eq (aref key 0) ?\M-x))
- (setq key (this-single-command-raw-keys)))
(setq keycast--this-command-keys key)
(setq keycast--this-command-desc
(cond ((symbolp cmd) cmd)
- [nongnu] elpa/keycast updated (b5e7a4561b -> b09491549b), ELPA Syncer, 2024/01/16
- [nongnu] elpa/keycast 13e18d84bb 4/6: keycast-show-minibuffer-exit-command: Add note about M-x, ELPA Syncer, 2024/01/16
- [nongnu] elpa/keycast f3509489f2 2/6: keycast--update: Fix special-handling of execute-extended-command,
ELPA Syncer <=
- [nongnu] elpa/keycast 12dbeb099b 3/6: By default only show minibuffer exiting command in log, ELPA Syncer, 2024/01/16
- [nongnu] elpa/keycast 988b051486 1/6: keycast--update: Fix a comment, ELPA Syncer, 2024/01/16
- [nongnu] elpa/keycast 8530b7565f 5/6: keycast--unpdate: Handle undefined keys, ELPA Syncer, 2024/01/16
- [nongnu] elpa/keycast b09491549b 6/6: Remove keycast-mode alias, ELPA Syncer, 2024/01/16