From 0e0ece32362bb5eed430328583018a35f44d3c7d Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Wed, 26 Jun 2024 11:47:34 +0200 Subject: [PATCH] transient--post-command: Clear transient-current-* variables here These variables are only intended to be accessible by the command that was invoked as a suffix of a prefix. It we only clear their values when we exit the prefix (but not when a non-exiting suffix is done), then the values remain accessible in timers and while the prefix is suspended (e.g., while using the minibuffer). --- lisp/transient.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index f26bd76..b348b80 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -2553,7 +2553,11 @@ value. Otherwise return CHILDREN as is." (transient--pop-keymap 'transient--redisplay-map) (setq transient--redisplay-map new) (transient--push-keymap 'transient--redisplay-map)) - (transient--redisplay))))))) + (transient--redisplay)))))) + (transient--debug 'clear-current) + (setq transient-current-prefix nil) + (setq transient-current-command nil) + (setq transient-current-suffixes nil)) (defun transient--post-exit (&optional command) (transient--debug 'post-exit) @@ -2576,9 +2580,6 @@ value. Otherwise return CHILDREN as is." (remove-hook 'pre-command-hook #'transient--pre-command) (remove-hook 'post-command-hook #'transient--post-command) (advice-remove 'recursive-edit #'transient--recursive-edit)) - (setq transient-current-prefix nil) - (setq transient-current-command nil) - (setq transient-current-suffixes nil) (let ((resume (and transient--stack (not (memq transient--exitp '(replace suspend)))))) (unless (or resume (eq transient--exitp 'replace))