summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2026-03-24 14:04:39 +0100
committerJonas Bernoulli <jonas@bernoul.li>2026-03-24 14:04:39 +0100
commit63f907237d248681c876eff59d624bff9c936876 (patch)
tree23234d54484a2b7a19a512af095fc473c1724b63
parent733c408d94aac9ca1660d14ff3aedc367abcd8ca (diff)
transient--wrap-command: Advise built-in commands via this-command
The advise is ineffective otherwise, as can be observed using (transient-define-prefix demo () [("g" "goto" goto-char :transient t)])
-rw-r--r--lisp/transient.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/transient.el b/lisp/transient.el
index cea49bb..c13cac2 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -3050,9 +3050,11 @@ value. Otherwise return CHILDREN as is.")
(when (symbolp command)
(remove-function (symbol-function command) advice))
(oset prefix unwind-suffix nil)))))
- (add-function :around (if (symbolp this-command)
- (symbol-function this-command)
- this-command)
+ (add-function :around
+ (if (and (symbolp this-command)
+ (not (subrp (symbol-function this-command))))
+ (symbol-function this-command)
+ this-command)
advice '((depth . -99)))
(cl-assert
(>= emacs-major-version 30) nil
@@ -3103,9 +3105,11 @@ value. Otherwise return CHILDREN as is.")
(setq advice `(lambda (fn &rest args)
(interactive ,advice-interactive)
(apply ',advice-body fn args)))
- (add-function :around (if (symbolp this-command)
- (symbol-function this-command)
- this-command)
+ (add-function :around
+ (if (and (symbolp this-command)
+ (not (subrp (symbol-function this-command))))
+ (symbol-function this-command)
+ this-command)
advice '((depth . -99))))))
(defun transient--premature-post-command ()