From b400caeb52fe67419d29713a0f16c8118a56f303 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sat, 11 Apr 2026 14:36:08 +0200 Subject: Backport dabbrev-capf bugfix permanently Closes #5556. --- lisp/git-commit.el | 9 +-------- lisp/magit-base.el | 11 +++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lisp/git-commit.el b/lisp/git-commit.el index be11380..9535c63 100644 --- a/lisp/git-commit.el +++ b/lisp/git-commit.el @@ -629,14 +629,7 @@ completing modified symbols and other text appearing in the diff." (unless dabbrev--abbrev-char-regexp ;; Initialize (not "reset") variables. See #5545. (dabbrev--reset-global-variables)) - ;; Our wrapper backports bugfix from debbug#80645 / a7d05207214. See #5551. - (add-hook 'completion-at-point-functions #'git-commit--dabbrev-capf -90 t)) - -(defun git-commit--dabbrev-capf () - (static-if (magit--version>= emacs-version "31.1") - (dabbrev-capf) - (cl-letf (((symbol-function #'user-error) (lambda (&rest _)))) - (dabbrev-capf)))) + (add-hook 'completion-at-point-functions #'dabbrev-capf -90 t)) (defun git-commit-setup-changelog-support () "Treat ChangeLog entries as unindented paragraphs." diff --git a/lisp/magit-base.el b/lisp/magit-base.el index 5f5ec06..cdb8e20 100644 --- a/lisp/magit-base.el +++ b/lisp/magit-base.el @@ -1042,6 +1042,17 @@ setting `imenu--index-alist' to nil before calling that function." (setq imenu--index-alist nil) (which-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)))) + ;;; Kludges for Custom (defun magit-custom-initialize-reset (symbol exp) -- cgit v1.0