branch: externals/transient commit d9b3a54128065222d35ce4ba49cdb39e23a06d2f Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
transient--delay-post-command: Handle execute-extended-command When using `execute-extended-command' to call another command that also uses the minibuffer, then this hook function is never called with `this-command' being `execute-extended-command' and the event being non-nil, so this failed to resume the transient state. `execute-extended-command' sets `this-command' and `real-this-command' so we need to rely on a different signal to determine when to resume. This function also changes the value returned by `this-command-keys' in predictable fashion, so we can rely on that. Not that we would want to do that anyway, but note that editing `execute-extended-command' so that it does not set `this-command' and `real-this-command' does not work. I was unable to determine where that happens, but something else is setting these variable on behalf of this command. Using a (renamed) copy of this command with only the code that sets these variables removed, however succeeds. --- lisp/transient.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index ebe6848dc2..d28eba6344 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -2169,8 +2169,13 @@ value. Otherwise return CHILDREN as is." (unless abort-only (setq post-command (lambda () "@transient--delay-post-command" - (let ((act (and (eq this-command command) - (not (eq (this-command-keys-vector) []))))) + (let ((act (and (not (eq (this-command-keys-vector) [])) + (or (eq this-command command) + ;; `execute-extended-command' was + ;; used to call another command + ;; that also uses the minibuffer. + (equal (this-command-keys) + (format "\M-x%s\r" this-command)))))) (transient--debug 'post-command-hook "act: %s" act) (when act (remove-hook 'transient--post-command-hook post-command)