unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 61215@debbugs.gnu.org
Subject: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
Date: Sun, 05 Feb 2023 20:28:24 +0200	[thread overview]
Message-ID: <86ilggc6gn.fsf@mail.linkov.net> (raw)
In-Reply-To: <83pmarufgi.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 03 Feb 2023 13:59:57 +0200")

> 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	other threads:[~2023-02-05 18:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 18:18 bug#61215: 29.0.60; font-lock broken in diff-mode with long lines Juri Linkov
2023-02-01 18:35 ` Eli Zaretskii
2023-02-02 17:16   ` Juri Linkov
2023-02-02 20:41     ` Eli Zaretskii
2023-02-03  7:53       ` Juri Linkov
2023-02-03 11:59         ` Eli Zaretskii
2023-02-05 18:28           ` Juri Linkov [this message]
2023-02-05 18:38             ` Eli Zaretskii
2023-02-06 17:15               ` Juri Linkov
2023-02-06 18:10                 ` Eli Zaretskii
2023-02-06 18:11                   ` Gregory Heytings
2023-02-27 18:28                   ` Juri Linkov
2023-02-27 19:07                     ` Eli Zaretskii
2023-02-27 19:23                     ` Gregory Heytings
2023-02-27 19:25                       ` Gregory Heytings
2023-03-30 23:22     ` Gregory Heytings
2023-03-31  7:10       ` Juri Linkov
2023-03-31  7:30         ` Juri Linkov
2023-04-01  0:22           ` Gregory Heytings
2023-04-01 18:19             ` Juri Linkov
2023-03-31  7:40         ` Gregory Heytings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ilggc6gn.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=61215@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).