]> git.eshelyaron.com Git - emacs.git/commit
Fix fontification outside hunks in Git patches
authorStefan Kangas <stefankangas@gmail.com>
Mon, 3 Mar 2025 17:37:43 +0000 (18:37 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 4 Mar 2025 21:04:38 +0000 (22:04 +0100)
commita2370bb043b2236a6fb0e54b5652feeb2992b8e9
tree7c52dca1b12aff943c43254a7ffd05274682d912
parent5ae4b18982c5a91fa5284a18c136b4d0463ddf91
Fix fontification outside hunks in Git patches

* lisp/vc/diff-mode.el (diff-font-lock-keywords): Don't fontify lines in
Git patches starting with + or - as added/removed, if they are either
before the first hunk, or in the email signature.  (Bug#75884)
(diff-buffer-type): Move definition up.
(diff--indicator-added-re, diff--indicator-removed-re): New variables.
(diff--git-preamble-end, diff--git-footer-start)
(diff--indicator-matcher-helper, diff--indicator-added-matcher)
(diff--indicator-removed-matcher): New functions.
* test/lisp/vc/diff-mode-tests.el (diff-mode-test-git-patch)
(diff-mode-test-git-patch/before-first-hunk)
(diff-mode-test-git-patch/signature): New tests.
* test/lisp/vc/diff-mode-resources/git.patch: New file.

(cherry picked from commit 10abb87f0519b3d53d6b7078703d3a0120e3aaa8)
lisp/vc/diff-mode.el
test/lisp/vc/diff-mode-resources/git.patch [new file with mode: 0644]
test/lisp/vc/diff-mode-tests.el