@@ -2194,32 +2194,37 @@ value. Otherwise return CHILDREN as is."
21942194 ,@body )))
21952195
21962196(defun transient--wrap-command ()
2197- (letrec ((prefix transient--prefix)
2198- (suffix this-command)
2199- (advice (lambda (fn &rest args )
2200- (interactive
2201- (lambda (spec )
2202- (let ((abort t ))
2203- (unwind-protect
2204- (prog1 (advice-eval-interactive-spec spec)
2205- (setq abort nil ))
2206- (when abort
2207- (when-let ((unwind (oref prefix unwind-suffix)))
2208- (transient--debug 'unwind-interactive )
2209- (funcall unwind suffix))
2210- (if (symbolp suffix)
2211- (advice-remove suffix advice)
2212- (remove-function suffix advice))
2213- (oset prefix unwind-suffix nil ))))))
2214- (unwind-protect
2215- (apply fn args)
2216- (when-let ((unwind (oref prefix unwind-suffix)))
2217- (transient--debug 'unwind-command )
2218- (funcall unwind suffix))
2219- (if (symbolp suffix)
2220- (advice-remove suffix advice)
2221- (remove-function suffix advice))
2222- (oset prefix unwind-suffix nil )))))
2197+ (let* ((prefix transient--prefix)
2198+ (suffix this-command)
2199+ (advice nil )
2200+ (advice-interactive
2201+ (lambda (spec )
2202+ (let ((abort t ))
2203+ (unwind-protect
2204+ (prog1 (advice-eval-interactive-spec spec)
2205+ (setq abort nil ))
2206+ (when abort
2207+ (when-let ((unwind (oref prefix unwind-suffix)))
2208+ (transient--debug 'unwind-interactive )
2209+ (funcall unwind suffix))
2210+ (if (symbolp suffix)
2211+ (advice-remove suffix advice)
2212+ (remove-function suffix advice))
2213+ (oset prefix unwind-suffix nil ))))))
2214+ (advice-body
2215+ (lambda (fn &rest args )
2216+ (unwind-protect
2217+ (apply fn args)
2218+ (when-let ((unwind (oref prefix unwind-suffix)))
2219+ (transient--debug 'unwind-command )
2220+ (funcall unwind suffix))
2221+ (if (symbolp suffix)
2222+ (advice-remove suffix advice)
2223+ (remove-function suffix advice))
2224+ (oset prefix unwind-suffix nil )))))
2225+ (setq advice `(lambda (fn &rest args)
2226+ (interactive ,advice-interactive )
2227+ (apply ',advice-body fn args)))
22232228 (if (symbolp suffix)
22242229 (advice-add suffix :around advice '((depth . -99 )))
22252230 (add-function :around (var suffix) advice '((depth . -99 ))))))
0 commit comments