summaryrefslogtreecommitdiff
path: root/lisp/vc/diff-mode.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-05-20 03:38:27 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-05-20 03:38:27 +0200
commit871f0f0a5de2b30944348ad9bf708cb8611b27fe (patch)
tree368893e7a1d9d727c0afc46b1cc028fce1c83746 /lisp/vc/diff-mode.el
parent4d7390576b1fdc385e48ae9eab19f70c82643c0c (diff)
downloademacs-871f0f0a5de2b30944348ad9bf708cb8611b27fe.tar.gz
emacs-871f0f0a5de2b30944348ad9bf708cb8611b27fe.tar.bz2
emacs-871f0f0a5de2b30944348ad9bf708cb8611b27fe.zip
Make diff--font-lock-prettify do less if we don't have a left fringe
* lisp/vc/diff-mode.el (diff--font-lock-prettify): Don't remove insert/deletions from the buffer if we don't have a left fringe (bug#37019).
Diffstat (limited to 'lisp/vc/diff-mode.el')
-rw-r--r--lisp/vc/diff-mode.el28
1 files changed, 15 insertions, 13 deletions
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 5c13c7fc389..0fd67422d55 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2600,19 +2600,21 @@ fixed, visit it in a buffer."
(defun diff--font-lock-prettify (limit)
(when diff-font-lock-prettify
- (save-excursion
- ;; FIXME: Include the first space for context-style hunks!
- (while (re-search-forward "^[-+! ]" limit t)
- (unless (eq (get-text-property (match-beginning 0) 'face) 'diff-header)
- (let ((spec
- (alist-get
- (char-before)
- '((?+ . (left-fringe diff-fringe-add diff-indicator-added))
- (?- . (left-fringe diff-fringe-del diff-indicator-removed))
- (?! . (left-fringe diff-fringe-rep diff-indicator-changed))
- (?\s . (left-fringe diff-fringe-nul fringe))))))
- (put-text-property (match-beginning 0) (match-end 0)
- 'display spec)))))
+ (when (> (frame-parameter nil 'left-fringe) 0)
+ (save-excursion
+ ;; FIXME: Include the first space for context-style hunks!
+ (while (re-search-forward "^[-+! ]" limit t)
+ (unless (eq (get-text-property (match-beginning 0) 'face)
+ 'diff-header)
+ (put-text-property
+ (match-beginning 0) (match-end 0)
+ 'display
+ (alist-get
+ (char-before)
+ '((?+ . (left-fringe diff-fringe-add diff-indicator-added))
+ (?- . (left-fringe diff-fringe-del diff-indicator-removed))
+ (?! . (left-fringe diff-fringe-rep diff-indicator-changed))
+ (?\s . (left-fringe diff-fringe-nul fringe)))))))))
;; Mimicks the output of Magit's diff.
;; FIXME: This has only been tested with Git's diff output.
;; FIXME: Add support for Git's "rename from/to"?