bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61215: 29.0.60; font-lock broken in diff-mode with long lines


From: Eli Zaretskii
Subject: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
Date: Thu, 02 Feb 2023 22:41:31 +0200

> From: Juri Linkov <juri@linkov.net>
> Cc: 61215@debbugs.gnu.org
> Date: Thu, 02 Feb 2023 19:16:34 +0200
> 
> > Thanks.  Can you post a recipe for reproducing that, preferably
> > starting from "emacs -Q"?
> 
> 0. emacs -Q
> 1. Set debug-on-error and backtrace-on-redisplay-error to t
> 2. Create a commit with some diff hunks in a prog mode at the beginning,
>    and a single-line 1MB file added at the end;
> 3. From *vc-change-log* type `d' on that commit that opens *vc-diff* buffer
> 4. Scroll the *vc-diff* buffer
> 
> It displays an error in the *Warning* buffer:
> 
>   ⛔ Warning (error): Error in a redisplay Lisp hook.  See buffer 
> *Redisplay_trace*

Can you reproduce this easily?  If so, does the patch below help?

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index eb01ded..9bc742a 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2762,7 +2762,8 @@ diff-syntax-fontify-hunk
   "Highlight source language syntax in diff hunk between BEG and END.
 When OLD is non-nil, highlight the hunk from the old source."
   (goto-char beg)
-  (let* ((hunk (buffer-substring-no-properties beg end))
+  (let* ((hunk (buffer-substring-no-properties (max beg (point-min))
+                                               (min end (point-max))))
          ;; Trim a trailing newline to find hunk in diff-syntax-fontify-props
          ;; in diffs that have no newline at end of diff file.
          (text (string-trim-right





reply via email to

[Prev in Thread] Current Thread [Next in Thread]