aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2026-04-16 14:59:31 +0200
committerJonas Bernoulli <jonas@bernoul.li>2026-04-16 14:59:31 +0200
commit83d899b66f2aa4744498baa6866f3bdec2d238be (patch)
tree40932e913de7472f78c99a710eb4163c8ae9723b
parentf0ead86bb4992b4bb56c48ba26b8b349d269053d (diff)
Properly implement dabbrev-capf bugfix backport
`dabbrev-capf' does not call `user-error'; in actuality it merely includes in its return value a function, which calls `user-error'. That function is what needs to be advised to neuter that incorrect use of `user-error'. Also use `condition-case' instead of `cl-letf'. Closes #5559. Suggested-by: Stefan Monnier <monnier@iro.umontreal.ca>
-rw-r--r--lisp/magit-base.el17
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/magit-base.el b/lisp/magit-base.el
index 53916cf..0c50e72 100644
--- a/lisp/magit-base.el
+++ b/lisp/magit-base.el
@@ -1048,13 +1048,16 @@ setting `imenu--index-alist' to nil before calling that function."
(static-if (version< emacs-version "31.1")
(define-advice dabbrev-capf (:around (fn) git-commit)
"Backport bugfix from debbug#80645 / a7d05207214 / 31.1.
-See #5551 and #5556."
- (cl-letf (((symbol-function #'user-error)
- (lambda (format &rest args)
- (unless (string-prefix-p "No dynamic expansion" format)
- (signal 'user-error
- (list (apply #'format-message format args)))))))
- (funcall fn))))
+ See #5551, #5556 and #5558 (I wish I had not rushed this)."
+ (pcase-let ((`(,beg ,end ,table . ,rest) (funcall fn)))
+ `( ,beg ,end
+ ,(lambda (&rest args)
+ (condition-case err
+ (apply table args)
+ (user-error
+ (unless (string-prefix-p "No dynamic expansion" (cadr err))
+ (signal (car err) (cdr err))))))
+ ,@rest))))
;;; Kludges for Custom