mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
(diff--font-lock-prettify): Fix fringe width test
* lisp/vc/diff-mode.el (diff--font-lock-prettify): Use 'window-fringes' instead of the 'left-fringe' frame parameter since the former returns an integer on both GUI and TTY frames.
This commit is contained in:
parent
01e351de60
commit
ff05a689e3
1 changed files with 6 additions and 3 deletions
|
|
@ -1600,7 +1600,7 @@ else cover the whole buffer."
|
||||||
(remove-overlays nil nil 'diff-mode 'syntax)
|
(remove-overlays nil nil 'diff-mode 'syntax)
|
||||||
(when font-lock-mode
|
(when font-lock-mode
|
||||||
(make-local-variable 'font-lock-extra-managed-props)
|
(make-local-variable 'font-lock-extra-managed-props)
|
||||||
;; Added when diff--font-lock-prettify is non-nil!
|
;; Added when diff-font-lock-prettify is non-nil!
|
||||||
(cl-pushnew 'display font-lock-extra-managed-props)))
|
(cl-pushnew 'display font-lock-extra-managed-props)))
|
||||||
|
|
||||||
(defvar-local diff-mode-read-only nil
|
(defvar-local diff-mode-read-only nil
|
||||||
|
|
@ -2949,7 +2949,10 @@ fixed, visit it in a buffer."
|
||||||
|
|
||||||
(defun diff--font-lock-prettify (limit)
|
(defun diff--font-lock-prettify (limit)
|
||||||
(when diff-font-lock-prettify
|
(when diff-font-lock-prettify
|
||||||
(when (> (frame-parameter nil 'left-fringe) 0)
|
;; FIXME: `window-fringes` uselessly allocates 4 cons cells,
|
||||||
|
;; but the previous use of `frame-paramter' ended up internally
|
||||||
|
;; calling `frame-parameters' making it even worse!
|
||||||
|
(when (> (car (window-fringes)) 0)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
;; FIXME: Include the first space for context-style hunks!
|
;; FIXME: Include the first space for context-style hunks!
|
||||||
(while (re-search-forward "^[-+! ]" limit t)
|
(while (re-search-forward "^[-+! ]" limit t)
|
||||||
|
|
@ -2965,7 +2968,7 @@ fixed, visit it in a buffer."
|
||||||
(?! . (left-fringe diff-fringe-rep diff-indicator-changed))
|
(?! . (left-fringe diff-fringe-rep diff-indicator-changed))
|
||||||
(?\s . (left-fringe diff-fringe-nul fringe)))))))))
|
(?\s . (left-fringe diff-fringe-nul fringe)))))))))
|
||||||
;; Mimics the output of Magit's diff.
|
;; Mimics the output of Magit's diff.
|
||||||
;; FIXME: This has only been tested with Git's diff output.
|
;; FIXME: This has been tested only with Git's diff output.
|
||||||
;; FIXME: Add support for Git's "rename from/to"?
|
;; FIXME: Add support for Git's "rename from/to"?
|
||||||
(while (re-search-forward "^diff " limit t)
|
(while (re-search-forward "^diff " limit t)
|
||||||
;; We split the regexp match into a search plus a looking-at because
|
;; We split the regexp match into a search plus a looking-at because
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue