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: Sun, 05 Feb 2023 20:38:48 +0200

> From: Juri Linkov <juri@linkov.net>
> Cc: 61215@debbugs.gnu.org
> Date: Sun, 05 Feb 2023 20:28:24 +0200
> 
> > diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
> > index eb01ded..62db362 100644
> > --- a/lisp/vc/diff-mode.el
> > +++ b/lisp/vc/diff-mode.el
> > @@ -2762,7 +2762,10 @@ 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 (min (max beg (point-min))
> > +                                                    (point-max))
> > +                                               (max (min end (point-max))
> > +                                                    (point-min))))
> 
> Now a new error:
> 
> Debugger entered--Lisp error: (error "Unknown diff hunk type")
>   signal(error ("Unknown diff hunk type"))
>   error("Unknown diff hunk type")
>   diff-hunk-text("" t nil)
>   diff-syntax-fontify-hunk(2000 250992 nil)
>   diff-syntax-fontify(2000 250992)
>   #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_39>(2000 250992)
>   diff--iterate-hunks(10000 #<subr 
> F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_39>)
>   diff--font-lock-syntax(10000)
>   font-lock-fontify-keywords-region(1527 10000 nil)
>   font-lock-default-fontify-region(1527 3027 nil)
>   font-lock-fontify-region(1527 3027)
>   #f(compiled-function (fun) #<bytecode 
> -0x156e32bfeabd7fc3>)(font-lock-fontify-region)
>   run-hook-wrapped(#f(compiled-function (fun) #<bytecode 
> -0x156e32bfeabd7fc3>) font-lock-fontify-region)
>   jit-lock--run-functions(1527 3027)
>   jit-lock-fontify-now(1527 3027)
>   jit-lock-function(1527)
>   redisplay_internal\ \(C\ function\)()
> 
> If you think the problem is in diff-syntax-fontify-hunk,
> then I could try to find a working workaround local to diff-mode.

Yes, now this is something for diff-mode to solve: it shouldn't assume
that it will always be able to go to the beginning and the end of a
hunk, because narrowing could interfere with that.  Diff-mode should
have some fallback plan for these cases.

Let me know whether you want me to install the last patch I proposed,
or you will do so as part of fixing all of these issues in diff-mode
together.





reply via email to

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