[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm 4b69c34540 2/3: Disable helm-define-key-with-subkeys
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm 4b69c34540 2/3: Disable helm-define-key-with-subkeys when in kbd macro |
Date: |
Thu, 21 Jul 2022 14:58:42 -0400 (EDT) |
branch: elpa/helm
commit 4b69c3454027576429ce7ab24658db17a1d44076
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Disable helm-define-key-with-subkeys when in kbd macro
Entering the loop is fine while defining kbd macro as long as the next
command do not use a minibuffer, if it is the case this next command
will not run properly because the minibuffer is in use.
To fix this only run COMMAND and exit in such cases.
Update docstring as well.
---
helm-core.el | 61 +++++++++++++++++++++++++++++++-----------------------------
1 file changed, 32 insertions(+), 29 deletions(-)
diff --git a/helm-core.el b/helm-core.el
index d387196893..ed88920deb 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -134,34 +134,35 @@ and second call within 1s runs `helm-swap-windows'."
(lambda ()
(interactive)
(let (timer)
- (unwind-protect
- (progn
- (call-interactively command)
- (when delay
- (setq timer (run-with-idle-timer
- delay nil (lambda () (keyboard-quit)))))
- (while (let ((input (read-key prompt)) other kb com)
- (setq last-command-event input)
- (cond
- ((eq input subkey)
- (call-interactively command)
- (setq last-command command)
- t)
- ((setq other (assoc input other-subkeys))
- (call-interactively (cdr other))
- (setq last-command (cdr other))
- t)
- (t
- (setq kb (vector last-command-event))
- (setq com (lookup-key map kb))
- (if (commandp com)
- (call-interactively com)
- (setq unread-command-events
- (nconc (mapcar #'identity kb)
- unread-command-events)))
- nil)))))
- (when timer (cancel-timer timer))
- (and exit-fn (funcall exit-fn))))))
+ (call-interactively command)
+ (unless (or defining-kbd-macro executing-kbd-macro)
+ (unwind-protect
+ (progn
+ (when delay
+ (setq timer (run-with-idle-timer
+ delay nil (lambda () (keyboard-quit)))))
+ (while (let ((input (read-key prompt)) other kb com)
+ (setq last-command-event input)
+ (cond
+ ((eq input subkey)
+ (call-interactively command)
+ (setq last-command command)
+ t)
+ ((setq other (assoc input other-subkeys))
+ (call-interactively (cdr other))
+ (setq last-command (cdr other))
+ t)
+ (t
+ (setq kb (vector last-command-event))
+ (setq com (lookup-key map kb))
+ (if (commandp com)
+ (call-interactively com)
+ (setq unread-command-events
+ (nconc (mapcar #'identity kb)
+ unread-command-events)))
+ nil)))))
+ (when timer (cancel-timer timer))
+ (and exit-fn (funcall exit-fn)))))))
;;;###autoload
(defun helm-define-key-with-subkeys (map key subkey command
@@ -195,7 +196,9 @@ in MAP and then exit the loop running EXIT-FN, if specified.
If DELAY an integer is specified exit after DELAY seconds.
NOTE: SUBKEY and OTHER-SUBKEYS bindings support only char syntax
-and vectors, so don't use strings to define them."
+and vectors, so don't use strings to define them. While defining
+or executing a kbd macro no SUBKEY or OTHER-SUBKEYS are provided,
+i.e. the loop is not entered after running COMMAND."
(declare (indent 1))
(let ((fn (helm-command-with-subkeys
map subkey command other-subkeys prompt exit-fn delay))