Skip to content

Commit

Permalink
transient--post-command: Clear transient-current-* variables here
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
tarsius committed Jun 25, 2024
1 parent 2d6fae0 commit 8cb671b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lisp/transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -2528,6 +2528,10 @@ value. Otherwise return CHILDREN as is."
t)))

(defun transient--post-command ()
(transient--debug 'clear-current)
(setq transient-current-prefix nil)
(setq transient-current-command nil)
(setq transient-current-suffixes nil)
(unless (transient--premature-post-command)
(transient--debug 'post-command)
(transient--with-emergency-exit :post-command
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 8cb671b

Please sign in to comment.