[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm f9593496f5 3/3: Fix helm-M-x prefix arg after resume
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm f9593496f5 3/3: Fix helm-M-x prefix arg after resume |
Date: |
Sat, 23 Apr 2022 12:58:33 -0400 (EDT) |
branch: elpa/helm
commit f9593496f592302c1228b41ee53ce0995db0c5df
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Fix helm-M-x prefix arg after resume
---
helm-command.el | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/helm-command.el b/helm-command.el
index a794c4465d..4e709a3400 100644
--- a/helm-command.el
+++ b/helm-command.el
@@ -249,7 +249,19 @@ algorithm."
(persistent-help :initform "Describe this command")
(help-message :initform 'helm-M-x-help-message)
(nomark :initform t)
- (keymap :initform 'helm-M-x-map)))
+ (cleanup :initform #'helm-M-x--unwind-forms)
+ (keymap :initform 'helm-M-x-map)
+ (resume :initform 'helm-M-x-resume-fn)))
+
+(defun helm-M-x-resume-fn ()
+ (when (and helm-M-x--timer (timerp helm-M-x--timer))
+ (cancel-timer helm-M-x--timer)
+ (setq helm-M-x--timer nil))
+ (setq helm-M-x--timer (run-at-time 1 0.1 'helm-M-x--notify-prefix-arg))
+ (setq helm--mode-line-display-prefarg t)
+ ;; Prevent displaying a wrong prefix arg when helm-resume is called
+ ;; from prefix arg.
+ (setq current-prefix-arg nil))
(defun helm-M-x-read-extended-command (collection &optional predicate history)
"Read or execute action on command name in COLLECTION or HISTORY.
@@ -265,8 +277,8 @@ Arg COLLECTION should be an `obarray' but can be any object
suitable for `try-completion'. Arg PREDICATE is a function that
default to `commandp' see also `try-completion'. Arg HISTORY
default to `extended-command-history'."
- (let* ((helm--mode-line-display-prefarg t)
- (pred (or predicate #'commandp))
+ (setq helm--mode-line-display-prefarg t)
+ (let* ((pred (or predicate #'commandp))
(helm-fuzzy-sort-fn (lambda (candidates _source)
;; Sort on real candidate otherwise
;; "symbol (<binding>)" is used when sorting.