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: Juri Linkov
Subject: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
Date: Sun, 05 Feb 2023 20:28:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> This probably means diff-mode relies on the buffer being widened.
> Which is a bad idea for font-lock functions.
>
> Anyway, how about the below?
>
> 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.





reply via email to

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