branch: externals/transient commit d3500a804e41e4e4f58a534019518e4fcd18f6bf Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
transient--wrap-command: Rename internal variable `suffix' is not appropriate because when the prefix allows invocation of non-suffixes, then this can be a non-suffix. We cannot just us `this-command' directly because the command may change the value of that and then we would fail to remove our advice. --- lisp/transient.el | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index 4b06514afd..4f760af67f 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -2655,8 +2655,8 @@ value. Otherwise return CHILDREN as is.") (defun transient--wrap-command () (static-if (>= emacs-major-version 30) (letrec - ((prefix transient--prefix) - (suffix this-command) + ((cmd this-command) + (prefix transient--prefix) (advice (lambda (fn &rest args) (interactive @@ -2664,7 +2664,7 @@ value. Otherwise return CHILDREN as is.") (let ((abort t)) (unwind-protect (prog1 (let ((debugger #'transient--exit-and-debug)) - (if-let* ((obj (transient-suffix-object suffix)) + (if-let* ((obj (transient-suffix-object cmd)) (grp (oref obj parent)) (adv (or (oref obj advice*) (oref grp advice*)))) @@ -2675,12 +2675,12 @@ value. Otherwise return CHILDREN as is.") (when abort (when-let ((unwind (oref prefix unwind-suffix))) (transient--debug 'unwind-interactive) - (funcall unwind suffix)) - (advice-remove suffix advice) + (funcall unwind cmd)) + (advice-remove cmd advice) (oset prefix unwind-suffix nil)))))) (unwind-protect (let ((debugger #'transient--exit-and-debug)) - (if-let* ((obj (transient-suffix-object suffix)) + (if-let* ((obj (transient-suffix-object cmd)) (grp (oref obj parent)) (adv (or (oref obj advice) (oref grp advice) @@ -2690,24 +2690,24 @@ value. Otherwise return CHILDREN as is.") (apply fn args))) (when-let ((unwind (oref prefix unwind-suffix))) (transient--debug 'unwind-command) - (funcall unwind suffix)) - (advice-remove suffix advice) + (funcall unwind cmd)) + (advice-remove cmd advice) (oset prefix unwind-suffix nil))))) (when (symbolp this-command) - (advice-add suffix :around advice '((depth . -99)))) + (advice-add cmd :around advice '((depth . -99)))) (cl-assert (>= emacs-major-version 30) nil "Emacs was downgraded, making it necessary to recompile Transient")) ;; (< emacs-major-version 30) - (let* ((prefix transient--prefix) - (suffix this-command) + (let* ((cmd this-command) + (prefix transient--prefix) (advice nil) (advice-interactive (lambda (spec) (let ((abort t)) (unwind-protect (prog1 (let ((debugger #'transient--exit-and-debug)) - (if-let* ((obj (transient-suffix-object suffix)) + (if-let* ((obj (transient-suffix-object cmd)) (grp (oref obj parent)) (adv (or (oref obj advice*) (oref grp advice*)))) @@ -2718,14 +2718,14 @@ value. Otherwise return CHILDREN as is.") (when abort (when-let ((unwind (oref prefix unwind-suffix))) (transient--debug 'unwind-interactive) - (funcall unwind suffix)) - (advice-remove suffix advice) + (funcall unwind cmd)) + (advice-remove cmd advice) (oset prefix unwind-suffix nil)))))) (advice-body (lambda (fn &rest args) (unwind-protect (let ((debugger #'transient--exit-and-debug)) - (if-let* ((obj (transient-suffix-object suffix)) + (if-let* ((obj (transient-suffix-object cmd)) (grp (oref obj parent)) (adv (or (oref obj advice) (oref grp advice) @@ -2735,14 +2735,14 @@ value. Otherwise return CHILDREN as is.") (apply fn args))) (when-let ((unwind (oref prefix unwind-suffix))) (transient--debug 'unwind-command) - (funcall unwind suffix)) - (advice-remove suffix advice) + (funcall unwind cmd)) + (advice-remove cmd advice) (oset prefix unwind-suffix nil))))) (setq advice `(lambda (fn &rest args) (interactive ,advice-interactive) (apply ',advice-body fn args))) (when (symbolp this-command) - (advice-add suffix :around advice '((depth . -99))))))) + (advice-add cmd :around advice '((depth . -99))))))) (defun transient--premature-post-command () (and (equal (this-command-keys-vector) [])