diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2026-03-25 23:58:35 +0100 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2026-03-25 23:58:35 +0100 |
| commit | d99366ff80778edc614ca28e06ec2b6f3ef48b33 (patch) | |
| tree | 9bfaec67ea5164a51e36ceb904b2f696b9268cc4 /lisp | |
| parent | f507bb3ecb4241b35c5e9bc036ef900b78e0ae01 (diff) | |
magit--blob-normal-mode: Fix the new font-lock kludge
Turns out `font-lock-mode' is called twice for the volatile blob
buffer we are dealing with here. Both calls need the `buffer-name'
kludge, as implemented by the advice we add here, else the second
call turns `font-lock-mode' off again.
Both calls to `font-lock-mode' are both triggered by `normal-mode';
via `after-change-major-mode-hook' and `set-auto-mode'.
Change the advice to no longer remove itself, once it dealt with the
buffer, for which it was added. Instead only remove the advice using
`unwind-protect' (that was already in place, but until now only
intended to clean up in case of an error).
Re #5543.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/magit-files.el | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lisp/magit-files.el b/lisp/magit-files.el index cfe237b..cd904f4 100644 --- a/lisp/magit-files.el +++ b/lisp/magit-files.el @@ -191,10 +191,9 @@ REV is a revision or one of \"{worktree}\" or \"{index}\"." (if (eq (aref buffer-name 0) ?\s) (letrec ((adv (lambda (fn &optional buffer) (let ((name (funcall fn buffer))) - (cond ((equal name buffer-name) - (advice-remove 'buffer-name adv) - (substring name 1)) - (name)))))) + (if (equal name buffer-name) + (substring name 1) + name))))) (advice-add 'buffer-name :around adv) (unwind-protect (normal-mode (not enable-local-variables)) |
