GNU bug report logs - #61215
29.0.60; font-lock broken in diff-mode with long lines

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Juri Linkov <juri@HIDDEN>; dated Wed, 1 Feb 2023 18:21:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 1 Apr 2023 18:48:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 01 14:48:47 2023
Received: from localhost ([127.0.0.1]:38598 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pigHP-0003Bb-EE
	for submit <at> debbugs.gnu.org; Sat, 01 Apr 2023 14:48:47 -0400
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:48917)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pigHN-0003BK-FD
 for 61215 <at> debbugs.gnu.org; Sat, 01 Apr 2023 14:48:45 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 358A5240003;
 Sat,  1 Apr 2023 18:48:37 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Gregory Heytings <gregory@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <f58e6a07f17c86e42d9d@HIDDEN> (Gregory Heytings's message
 of "Sat, 01 Apr 2023 00:22:16 +0000")
Organization: LINKOV.NET
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <e246266e9fd0d71a1abd@HIDDEN>
 <861ql51jl2.fsf@HIDDEN> <86tty1z7tf.fsf@HIDDEN>
 <f58e6a07f17c86e42d9d@HIDDEN>
Date: Sat, 01 Apr 2023 21:19:14 +0300
Message-ID: <867cuvfocl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 61215
Cc: Eli Zaretskii <eliz@HIDDEN>, 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> I just spent a couple of hours on this bug, and so far the only thing I can
> say for sure is that alas the patch you suggested does not work reliably:
> at least with the recipe I posted upthread the bug is still present.
> I don't yet know how to actually fix it, though :(

Did you do a full bootstrap after applying the patch?
It changes the macro, so at least diff-mode.el (that uses
this macro) needs to be recompiled afterwards.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 1 Apr 2023 00:22:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 31 20:22:20 2023
Received: from localhost ([127.0.0.1]:34889 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1piP0e-0006DI-BL
	for submit <at> debbugs.gnu.org; Fri, 31 Mar 2023 20:22:20 -0400
Received: from heytings.org ([95.142.160.155]:34410)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1piP0c-0006DA-7z
 for 61215 <at> debbugs.gnu.org; Fri, 31 Mar 2023 20:22:18 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1680308537;
 bh=vELYouqsAoDkI/AsWXpM/ltrtbnq1y2JmBTk7giH6JQ=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=mEnIM3fA98ie1APkKKz4guO90vNbDVH1/YB5cMGpH3ArLmr7R99fJXxb8nwc1W6NC
 pbW4b+zmviGTg4YhM2wKLCDgzrYh7PrOAMy1uc/3DIX+Pimc5NFTjDD4+dRsnCo1sV
 NQxtLX3FivzwlcBbg3WlFbsF0dxGJDqc5dpqrfdYH1r/WkIcm7bN2c0OEQdz7tZfbK
 HzVAeChokMZ/oWhyxMzEQfOjR+KWwlBfgBiWi6Fqy8cN4VRqP/TQk1eReWYOwU85mu
 WqtIwiZzGobh6XcrAMhIyHdSc9e5xMnY9x5FNxJNgOJ5smXi8iQhVLqM912/pVFRIZ
 91QNoXXbTpoWw==
Date: Sat, 01 Apr 2023 00:22:16 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <86tty1z7tf.fsf@HIDDEN>
Message-ID: <f58e6a07f17c86e42d9d@HIDDEN>
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <e246266e9fd0d71a1abd@HIDDEN>
 <861ql51jl2.fsf@HIDDEN> <86tty1z7tf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=us-ascii
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 61215
Cc: Eli Zaretskii <eliz@HIDDEN>, 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


I just spent a couple of hours on this bug, and so far the only thing I 
can say for sure is that alas the patch you suggested does not work 
reliably: at least with the recipe I posted upthread the bug is still 
present.  I don't yet know how to actually fix it, though :(





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 31 Mar 2023 07:42:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 31 03:42:59 2023
Received: from localhost ([127.0.0.1]:60280 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pi9PX-0004kq-Dp
	for submit <at> debbugs.gnu.org; Fri, 31 Mar 2023 03:42:59 -0400
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:47245)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pi9PW-0004ke-0y
 for 61215 <at> debbugs.gnu.org; Fri, 31 Mar 2023 03:42:58 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 09C0C40013;
 Fri, 31 Mar 2023 07:42:50 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Gregory Heytings <gregory@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <861ql51jl2.fsf@HIDDEN> (Juri Linkov's message of "Fri, 
 31 Mar 2023 10:10:20 +0300")
Organization: LINKOV.NET
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <e246266e9fd0d71a1abd@HIDDEN>
 <861ql51jl2.fsf@HIDDEN>
Date: Fri, 31 Mar 2023 10:30:32 +0300
Message-ID: <86tty1z7tf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 61215
Cc: Eli Zaretskii <eliz@HIDDEN>, 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>>> 1. (setq debug-on-error t backtrace-on-redisplay-error 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*
>>
>> I did, in the Emacs repository:
>>
>> echo README >> README
>> echo CONTRIBUTE >> CONTRIBUTE
>> echo INSTALL >> INSTALL
>
> Actually, these files can't expose the problem.
> I suggest to use a mode with complex font-lock rules
> for syntax highlighting.  I tested with a few of 1-char edits
> in a few places inside an .el file.
>
>> git add a.xml
>
> The diff will output the file name a.xml at the beginning, but
> better to output it after the file with changes.  The complete
> diff output should look like this: first a few diff hunks
> each with 1-line change from an .el file with syntax fontification.
> Then at the end of the screen the huge file added in the same commit.
>
>> git commit -a -m commit
>> ./src/emacs -Q --eval '(setq debug-on-error t backtrace-on-redisplay-error t)'
>> C-x v l
>> d
>
> Not sure if this shows diffs only from one file.
> More reliable would be to use 'C-x v L d'
> to show a multi-file commit.
>
>> At that point there are no errors, and the a.xml hunk is correctly
>> fontified.  Now if I do:
>>
>> q
>> d
>>
>> then the errors you mention above appear (and the a.xml hunk is not
>> correctly fontified anymore).  If I manually kill the *vc-diff* buffer,
>> they disappear again.  Is this also what you see?
>
> Hmm, I tried again, and can't reproduce it in emacs-29.
> But in master there are still the same errors.
> How this is possible when emacs-29 is merged to master?

After boostrap errors appear in emacs-29 too.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 31 Mar 2023 07:40:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 31 03:40:04 2023
Received: from localhost ([127.0.0.1]:60276 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pi9Mh-0004gf-Pt
	for submit <at> debbugs.gnu.org; Fri, 31 Mar 2023 03:40:04 -0400
Received: from heytings.org ([95.142.160.155]:33238)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1pi9Mg-0004gI-FL
 for 61215 <at> debbugs.gnu.org; Fri, 31 Mar 2023 03:40:02 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1680248401;
 bh=8hwfVHFLAWMM5oTaWvw1Nd2DSFotpsFbSKTcyABIrAY=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=1W5KI7bgV+vUw5nNBJ71gt3t8z+2FkCm26AoevVjgg6l0IM5BQMZmlhH0ptqK8KL4
 3yQKurq+aW3svnfMG1Fhj7knI69JDJ9l+BktOTU7JdFZCq+jdFaIr2ttm5ntnr9H8B
 AFkr5vJqKmAZv6azI5TPOcrjf9M5T5vSIitZnGgfGKTPW3YEIz6bTi1tEOcfJK6zLY
 YP1+eOcZXW9AtkzMXEOAcxjzrFcdwG4Ru4baOnkg8WuSVabXhvHwlSGgCEDjps07ja
 15KH4VHQ9F/BeXEO4q0rpYzKES9W9H1CgLUfyx6eG/gaJ3Ce2iksLGEPRBnpUHdq56
 FvDXFvT9RF/Mw==
Date: Fri, 31 Mar 2023 07:40:01 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <861ql51jl2.fsf@HIDDEN>
Message-ID: <58158ae4985b80a8af9a@HIDDEN>
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <e246266e9fd0d71a1abd@HIDDEN>
 <861ql51jl2.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 61215
Cc: Eli Zaretskii <eliz@HIDDEN>, 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>
> Actually, these files can't expose the problem. I suggest to use a mode 
> with complex font-lock rules for syntax highlighting.  I tested with a 
> few of 1-char edits in a few places inside an .el file.
>

Okay, so I tried again with:

sed -i 's/(signal /(signal  /' lisp/subr.el lisp/simple.el

(Note the two spaces after "signal".)

>> git add a.xml
>
> The diff will output the file name a.xml at the beginning, but better to 
> output it after the file with changes.  The complete diff output should 
> look like this: first a few diff hunks each with 1-line change from an 
> .el file with syntax fontification. Then at the end of the screen the 
> huge file added in the same commit.
>

With my previous recipe the added file was added at the end, but for some 
reason after the command above it does not.  I renamed the a.xml file into 
z.xml, and now it does again.

>> git commit -a -m commit
>> ./src/emacs -Q --eval '(setq debug-on-error t backtrace-on-redisplay-error t)'
>> C-x v l
>> d
>
> Not sure if this shows diffs only from one file. More reliable would be 
> to use 'C-x v L d' to show a multi-file commit.
>

Okay, with the modifications you indicated above, I can now reproduce the 
bug, with both C-x v l d and C-x v L RET d.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 31 Mar 2023 07:16:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 31 03:16:10 2023
Received: from localhost ([127.0.0.1]:60216 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pi8zZ-00044X-Qc
	for submit <at> debbugs.gnu.org; Fri, 31 Mar 2023 03:16:10 -0400
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:40709)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pi8zY-00043u-0t
 for 61215 <at> debbugs.gnu.org; Fri, 31 Mar 2023 03:16:08 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 17D2320009;
 Fri, 31 Mar 2023 07:15:58 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Gregory Heytings <gregory@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <e246266e9fd0d71a1abd@HIDDEN> (Gregory Heytings's message
 of "Thu, 30 Mar 2023 23:22:20 +0000")
Organization: LINKOV.NET
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <e246266e9fd0d71a1abd@HIDDEN>
Date: Fri, 31 Mar 2023 10:10:20 +0300
Message-ID: <861ql51jl2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 61215
Cc: Eli Zaretskii <eliz@HIDDEN>, 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> 1. (setq debug-on-error t backtrace-on-redisplay-error 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*
>
> I did, in the Emacs repository:
>
> echo README >> README
> echo CONTRIBUTE >> CONTRIBUTE
> echo INSTALL >> INSTALL

Actually, these files can't expose the problem.
I suggest to use a mode with complex font-lock rules
for syntax highlighting.  I tested with a few of 1-char edits
in a few places inside an .el file.

> git add a.xml

The diff will output the file name a.xml at the beginning, but
better to output it after the file with changes.  The complete
diff output should look like this: first a few diff hunks
each with 1-line change from an .el file with syntax fontification.
Then at the end of the screen the huge file added in the same commit.

> git commit -a -m commit
> ./src/emacs -Q --eval '(setq debug-on-error t backtrace-on-redisplay-error t)'
> C-x v l
> d

Not sure if this shows diffs only from one file.
More reliable would be to use 'C-x v L d'
to show a multi-file commit.

> At that point there are no errors, and the a.xml hunk is correctly
> fontified.  Now if I do:
>
> q
> d
>
> then the errors you mention above appear (and the a.xml hunk is not
> correctly fontified anymore).  If I manually kill the *vc-diff* buffer,
> they disappear again.  Is this also what you see?

Hmm, I tried again, and can't reproduce it in emacs-29.
But in master there are still the same errors.
How this is possible when emacs-29 is merged to master?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 30 Mar 2023 23:22:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 30 19:22:24 2023
Received: from localhost ([127.0.0.1]:59850 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pi1b6-0008QB-2p
	for submit <at> debbugs.gnu.org; Thu, 30 Mar 2023 19:22:24 -0400
Received: from heytings.org ([95.142.160.155]:32768)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1pi1b4-0008Q3-5E
 for 61215 <at> debbugs.gnu.org; Thu, 30 Mar 2023 19:22:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1680218540;
 bh=FkeuJqKWZIiLybm7OvKRS2RZeIrZYRBgqVJDe5ZluSY=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=K7a77S1YxpoSodHu4awekxDPQeNUjNpJF4A/1WVdbtnsCQGAnSTDzDnmQdmUkdw1O
 /vQj7JmazF4uMBDY6VYCb8QbfAJlcSZ9kSod7Soj9HgBQyrk0o82/8DZuVY6qkd34h
 nEwqzIkZnQ3UTII8/fatXqJ+XP9hKnC3snX2VIGkl9fe2/cuvdspZyVKxlnBVceUqg
 AF2qcT8Dl6Vt8V19N9dtgJwG5ZhLypmJAgggIQqUR8v3njVRM49alT6NIIVfzGI9T8
 OqngVW4TzzmNeXp8PNGhXPof7kWs9JxkkTuLCSHQKXoSvm5OPaDLmXfGqs8/rCByHk
 3/bmn3a2ngozw==
Date: Thu, 30 Mar 2023 23:22:20 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <86o7qcf2x5.fsf@HIDDEN>
Message-ID: <e246266e9fd0d71a1abd@HIDDEN>
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="fhsuVrtZ2a"
Content-ID: <e246266e9f01246ca0cf@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 61215
Cc: Eli Zaretskii <eliz@HIDDEN>, 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--fhsuVrtZ2a
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-ID: <e246266e9f5630eba5f0@HIDDEN>


>
> 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* buff=
er
> 4. Scroll the *vc-diff* buffer
>
> It displays an error in the *Warning* buffer:
>
>  =E2=9B=94 Warning (error): Error in a redisplay Lisp hook.  See buffer *=
Redisplay_trace*
>

Sorry for the (very!) late reply.

I tried to reproduce that issue with Emacs 29 (at 59f66ea302).  I used the=
=20
"a.xml" file from bug#61514, which can be recreated with the following=20
short Python script:

#!/usr/bin/python3
f =3D open("a.xml", "w")
f.write('<id name=3D"')
for n in range(1, 4096):
     f.write("n" * 1024)
f.write('">\n')

I did, in the Emacs repository:

echo README >> README
echo CONTRIBUTE >> CONTRIBUTE
echo INSTALL >> INSTALL
git add a.xml
git commit -a -m commit
=2E/src/emacs -Q --eval '(setq debug-on-error t backtrace-on-redisplay-erro=
r t)'
C-x v l
d

At that point there are no errors, and the a.xml hunk is correctly=20
fontified.  Now if I do:

q
d

then the errors you mention above appear (and the a.xml hunk is not=20
correctly fontified anymore).  If I manually kill the *vc-diff* buffer,=20
they disappear again.  Is this also what you see?

--fhsuVrtZ2a--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 27 Feb 2023 19:25:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 27 14:25:06 2023
Received: from localhost ([127.0.0.1]:48866 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pWj7S-0006X3-C9
	for submit <at> debbugs.gnu.org; Mon, 27 Feb 2023 14:25:06 -0500
Received: from heytings.org ([95.142.160.155]:47670)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1pWj7Q-0006Wu-Nz
 for 61215 <at> debbugs.gnu.org; Mon, 27 Feb 2023 14:25:05 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1677525904;
 bh=5UALPgYCS+hrJRaf0EmX5mk5nzW3PuJ13Nc5BDre6XQ=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=tnmm9OmV4wVpzW9KgRmwipDARYS4kzEyl+YeCKZ2H1VGLGX950/C2WVL9HURsEahT
 9x/S4x2ult7OZsKLzGRODExldJAWLv3Mwe96EwskFkfbTCHkvGuhXwTv+O3SFfiY+G
 b/GfHQGczVfU982Sw3q4QccteWanD2sl7L0xxHqpZiOyu39lk9F72bSFGvysDVjxfd
 0OTunfiABx+uXI9IZVDjUI/nMzuNB7WSCphDWX4nEnJp2wZcQMIpW5DtQDiqUdj8F8
 +qOYBLofpq9q3HUrgr/FEb6q7ChTsf9FCATnatWqgIXS7F4QgdOuU8i5t7j9yB6GlH
 XJOjXloZKo+EQ==
Date: Mon, 27 Feb 2023 19:25:03 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <9ac9271f1e747b4a1e20@HIDDEN>
Message-ID: <9ac9271f1e8ae64cab2b@HIDDEN>
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
 <86bkmbfalm.fsf@HIDDEN> <83pmarufgi.fsf@HIDDEN>
 <86ilggc6gn.fsf@HIDDEN> <83mt5sq7nr.fsf@HIDDEN>
 <86edr2davu.fsf@HIDDEN> <83lelapsvj.fsf@HIDDEN>
 <86o7pfc91a.fsf@HIDDEN> <9ac9271f1e747b4a1e20@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 61215
Cc: Eli Zaretskii <eliz@HIDDEN>, 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>>>> After debugging I discovered that the problem is not caused by 
>>>> font-lock in diff-mode.  The problem is in 
>>>> easy-mmode-define-navigation. diff-mode uses it to navigate diff 
>>>> hunks.  It supports such a feature that when the user narrowed the 
>>>> diff buffer, it puts narrowing back after moving to the next hunk. 
>>>> But this fails when the diff buffer is narrowed automatically by 
>>>> long-line-optimizations.  If there is no way to distinguish whether 
>>>> the narrowing is automatic by long-lines or manual by the user, this 
>>>> patch fixes the problem.  It works without errors, and even 
>>>> highlights first 250000 characters of the long line:
>>> 
>>> Thanks.
>>> 
>>> Maybe Gregory (CC'ed) can help here and tell whether there's a better 
>>> solution.
>> 
>> It seems there is no better solution?
>
> I still have to look at this, it's on my (short time) TODO list.
>

I meant "short term", of course.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 27 Feb 2023 19:23:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 27 14:23:17 2023
Received: from localhost ([127.0.0.1]:48862 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pWj5g-0006To-W2
	for submit <at> debbugs.gnu.org; Mon, 27 Feb 2023 14:23:17 -0500
Received: from heytings.org ([95.142.160.155]:47664)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1pWj5c-0006Tc-TC
 for 61215 <at> debbugs.gnu.org; Mon, 27 Feb 2023 14:23:14 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1677525791;
 bh=a9bFI8U/oCao+KkfwcXdbgA83jfSneoTdYUB+kzHyQw=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=hjJLTtpEZhpOfWP+hdlk0bdijt1wzkysTqY101Fzy9J7G81YPS3TlIsfwNxhTmrhG
 DbOhHL1DO9YWQgtTrmCKh+SA+wDqeV++U2kIDiQAmDWr8IK/+m7tk7u6SAWRi+/jWa
 A8LTdN2I1fmv1lmrcZ9wj29GKAEobxyAkFCD5l5GWKJ08V6sCbgBj1NyL5CSEzHEKu
 2nc4jiUUJefxESjHCKmmM7L6WTbiOhJ46QMMDTwvmq21UNDzb4Pzei1R/5mHk4eXyD
 JCEmohMnWY4kisBjXSHvlcKjgmOYcCWArVFlriBlVYRhTbtx2a3wgUdpRRYtp77v6W
 2W22hDgCQeDzQ==
Date: Mon, 27 Feb 2023 19:23:11 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <86o7pfc91a.fsf@HIDDEN>
Message-ID: <9ac9271f1e747b4a1e20@HIDDEN>
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
 <86bkmbfalm.fsf@HIDDEN> <83pmarufgi.fsf@HIDDEN>
 <86ilggc6gn.fsf@HIDDEN> <83mt5sq7nr.fsf@HIDDEN>
 <86edr2davu.fsf@HIDDEN> <83lelapsvj.fsf@HIDDEN>
 <86o7pfc91a.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 61215
Cc: Eli Zaretskii <eliz@HIDDEN>, 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>>> After debugging I discovered that the problem is not caused by 
>>> font-lock in diff-mode.  The problem is in 
>>> easy-mmode-define-navigation. diff-mode uses it to navigate diff 
>>> hunks.  It supports such a feature that when the user narrowed the 
>>> diff buffer, it puts narrowing back after moving to the next hunk. 
>>> But this fails when the diff buffer is narrowed automatically by 
>>> long-line-optimizations.  If there is no way to distinguish whether 
>>> the narrowing is automatic by long-lines or manual by the user, this 
>>> patch fixes the problem.  It works without errors, and even highlights 
>>> first 250000 characters of the long line:
>>
>> Thanks.
>>
>> Maybe Gregory (CC'ed) can help here and tell whether there's a better 
>> solution.
>
> It seems there is no better solution?
>

I still have to look at this, it's on my (short time) TODO list.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 27 Feb 2023 19:07:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 27 14:07:39 2023
Received: from localhost ([127.0.0.1]:48825 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pWiqY-00060u-Vs
	for submit <at> debbugs.gnu.org; Mon, 27 Feb 2023 14:07:39 -0500
Received: from eggs.gnu.org ([209.51.188.92]:50668)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pWiqX-00060g-30
 for 61215 <at> debbugs.gnu.org; Mon, 27 Feb 2023 14:07:37 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pWiqK-0005L0-5h; Mon, 27 Feb 2023 14:07:31 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=NV1Q58vBqB3zG4FGGDS+iBQEHPfq7puv1HrUCfN1rdQ=; b=hqySaowmAeAz
 e5RwyFN4q2tpRPpFukkVDH56777xZZ3KBk8rt2S0T0KN1UcYKaroLwqCQSwMl/ENq3jKB9oBfZoQc
 C1eOXxc1EweFlX/o2BiW14jBUT7p32I0A7SkmuKVEBb8Pj2U83x/zS7yHHz77M0BKvx86klgWj2dZ
 7kZ6EPZeTyz8Xfs1kzHZttX/ewRnvgk53xWVQn66lzBbpmAGWMhBxpPCfPhlMD7s5tkmWZrmUbjTj
 9AFNe4nujRX7a/6npRi/ouoWsK+cmcrmWJtCI2Zh6ol1AEytLQzZuby2NrEEP2AUDtQu9zQ2fjy3E
 5YGxZyQA6fNEUGHzP+DVRw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pWiqJ-0007Im-1L; Mon, 27 Feb 2023 14:07:23 -0500
Date: Mon, 27 Feb 2023 21:07:31 +0200
Message-Id: <83r0ubgc5o.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86o7pfc91a.fsf@HIDDEN> (message from Juri Linkov on
 Mon, 27 Feb 2023 20:28:33 +0200)
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
 <86bkmbfalm.fsf@HIDDEN> <83pmarufgi.fsf@HIDDEN>
 <86ilggc6gn.fsf@HIDDEN> <83mt5sq7nr.fsf@HIDDEN>
 <86edr2davu.fsf@HIDDEN> <83lelapsvj.fsf@HIDDEN>
 <86o7pfc91a.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 61215
Cc: gregory@HIDDEN, 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: Gregory Heytings <gregory@HIDDEN>,  61215 <at> debbugs.gnu.org
> Date: Mon, 27 Feb 2023 20:28:33 +0200
> 
> >> After debugging I discovered that the problem is not caused by font-lock
> >> in diff-mode.  The problem is in easy-mmode-define-navigation.
> >> diff-mode uses it to navigate diff hunks.  It supports such a feature
> >> that when the user narrowed the diff buffer, it puts narrowing back
> >> after moving to the next hunk.  But this fails when the diff buffer
> >> is narrowed automatically by long-line-optimizations.  If there is
> >> no way to distinguish whether the narrowing is automatic by long-lines
> >> or manual by the user, this patch fixes the problem.  It works without
> >> errors, and even highlights first 250000 characters of the long line:
> >
> > Thanks.
> >
> > Maybe Gregory (CC'ed) can help here and tell whether there's a better
> > solution.
> 
> It seems there is no better solution?

I think you should be able to use the new facilities to distinguish
between user narrowing and that due to long-line-optimizations.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 27 Feb 2023 18:35:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 27 13:35:20 2023
Received: from localhost ([127.0.0.1]:48759 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pWiLG-0000F3-Q0
	for submit <at> debbugs.gnu.org; Mon, 27 Feb 2023 13:35:20 -0500
Received: from relay11.mail.gandi.net ([217.70.178.231]:59213)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pWiKz-0000Dl-Oz
 for 61215 <at> debbugs.gnu.org; Mon, 27 Feb 2023 13:35:16 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 5CAAC100004;
 Mon, 27 Feb 2023 18:34:52 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <83lelapsvj.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 06 Feb
 2023 20:10:24 +0200")
Organization: LINKOV.NET
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
 <86bkmbfalm.fsf@HIDDEN> <83pmarufgi.fsf@HIDDEN>
 <86ilggc6gn.fsf@HIDDEN> <83mt5sq7nr.fsf@HIDDEN>
 <86edr2davu.fsf@HIDDEN> <83lelapsvj.fsf@HIDDEN>
Date: Mon, 27 Feb 2023 20:28:33 +0200
Message-ID: <86o7pfc91a.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 61215
Cc: Gregory Heytings <gregory@HIDDEN>, 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> After debugging I discovered that the problem is not caused by font-lock
>> in diff-mode.  The problem is in easy-mmode-define-navigation.
>> diff-mode uses it to navigate diff hunks.  It supports such a feature
>> that when the user narrowed the diff buffer, it puts narrowing back
>> after moving to the next hunk.  But this fails when the diff buffer
>> is narrowed automatically by long-line-optimizations.  If there is
>> no way to distinguish whether the narrowing is automatic by long-lines
>> or manual by the user, this patch fixes the problem.  It works without
>> errors, and even highlights first 250000 characters of the long line:
>
> Thanks.
>
> Maybe Gregory (CC'ed) can help here and tell whether there's a better
> solution.

It seems there is no better solution?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 6 Feb 2023 18:11:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 06 13:11:10 2023
Received: from localhost ([127.0.0.1]:49862 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pP5xL-0008GW-OJ
	for submit <at> debbugs.gnu.org; Mon, 06 Feb 2023 13:11:10 -0500
Received: from heytings.org ([95.142.160.155]:45928)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1pP5xH-0008GJ-6N
 for 61215 <at> debbugs.gnu.org; Mon, 06 Feb 2023 13:11:07 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1675707061;
 bh=wg1Q+FzDhsREqERh7V6brySNQrhPN1WXnblslUSWkok=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=AJuS91Zemi0/sidH914r9FwTmJP5FYSJb/ghZZsuurFUPCg1XulZHpsB7gmz+3tWB
 WLeuzxj0ay2qIsgky4KWqaOZ4RGGJkZsRgcyctrPPVAG4ekZ/FMPHOpw+60nxVdI+N
 pB/p3QzSXmUAg3+8N/cfqG1Xw3fYhdS8jDQ0H+7B2DNTTTgsJhw8Qgvuytqy1omxRA
 VjoOXxjg759NvofwgonOPi5nNH7MKYgGG1daGpfpOIxwvKWpaPELfIOwmsH6Kop+3f
 X6a/9oe5lpDSBXDRr/fZZQFG8meyRoFTaPrzpqAXAWZMOhkw4465PHpkcL8pfUyRtL
 oPbRsDZKCcQJg==
Date: Mon, 06 Feb 2023 18:11:01 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <83lelapsvj.fsf@HIDDEN>
Message-ID: <2e70e5184e9ce7a8cf5e@HIDDEN>
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
 <86bkmbfalm.fsf@HIDDEN> <83pmarufgi.fsf@HIDDEN>
 <86ilggc6gn.fsf@HIDDEN> <83mt5sq7nr.fsf@HIDDEN>
 <86edr2davu.fsf@HIDDEN> <83lelapsvj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 61215
Cc: 61215 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>
> Maybe Gregory (CC'ed) can help here and tell whether there's a better 
> solution.
>

I'll have a look in a few hours.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 6 Feb 2023 18:10:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 06 13:10:22 2023
Received: from localhost ([127.0.0.1]:49858 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pP5wc-0008F1-8y
	for submit <at> debbugs.gnu.org; Mon, 06 Feb 2023 13:10:22 -0500
Received: from eggs.gnu.org ([209.51.188.92]:46236)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pP5wa-0008Eg-7a
 for 61215 <at> debbugs.gnu.org; Mon, 06 Feb 2023 13:10:20 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pP5wU-0005bZ-Dc; Mon, 06 Feb 2023 13:10:14 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=y3ZHfuPpY8KSgGhOsio0bcitDcFSeDy92EXsVonTCCM=; b=M4oNQnrWph1D
 E6B5Gs2zWkl1ynFUw9oSDYkxcDgDfZ1hfVhxtj9Chv/fviIKu1ah63e2wr/TIItEffSMR+H/wtxbZ
 4bK6WRn4TgBJqanX3JFJUfLLybNVkLW3WmZCrWAhHxEBk9PK/PiGxDXYyu88qfQ/kbH5srY0zr658
 tupZftYS5/H1bDQw+XYXdoBxdTS/pmRiwYrhG9UQw0F+NFTUOFHCDEcd3QeLplnFWP1pv8XWD9vOj
 5BoCgsOTIK/pzH8qm3OoDQPhpOHW071w1sVbRzNGXPfzKdWEJkND6ojNNK9u5N7ZMvFiQB/YgH10A
 /rkYZMl/EYqDaGUszuoHZg==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pP5wQ-00016b-Rl; Mon, 06 Feb 2023 13:10:14 -0500
Date: Mon, 06 Feb 2023 20:10:24 +0200
Message-Id: <83lelapsvj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>, Gregory Heytings <gregory@HIDDEN>
In-Reply-To: <86edr2davu.fsf@HIDDEN> (message from Juri Linkov on
 Mon, 06 Feb 2023 19:15:49 +0200)
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
 <86bkmbfalm.fsf@HIDDEN> <83pmarufgi.fsf@HIDDEN>
 <86ilggc6gn.fsf@HIDDEN> <83mt5sq7nr.fsf@HIDDEN>
 <86edr2davu.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 61215
Cc: 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: 61215 <at> debbugs.gnu.org
> Date: Mon, 06 Feb 2023 19:15:49 +0200
> 
> >> 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.
> 
> After debugging I discovered that the problem is not caused by font-lock
> in diff-mode.  The problem is in easy-mmode-define-navigation.
> diff-mode uses it to navigate diff hunks.  It supports such a feature
> that when the user narrowed the diff buffer, it puts narrowing back
> after moving to the next hunk.  But this fails when the diff buffer
> is narrowed automatically by long-line-optimizations.  If there is
> no way to distinguish whether the narrowing is automatic by long-lines
> or manual by the user, this patch fixes the problem.  It works without
> errors, and even highlights first 250000 characters of the long line:

Thanks.

Maybe Gregory (CC'ed) can help here and tell whether there's a better
solution.

> diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
> index 5721470ad0d..d9176061434 100644
> --- a/lisp/emacs-lisp/easy-mmode.el
> +++ b/lisp/emacs-lisp/easy-mmode.el
> @@ -782,7 +782,10 @@ easy-mmode-define-navigation
>           (when-narrowed
>            (lambda (body)
>              (if (null narrowfun) body
> -              `(let ((was-narrowed (prog1 (buffer-narrowed-p) (widen))))
> +              `(let ((was-narrowed
> +                      (prog1 (unless (long-line-optimizations-p)
> +                               (buffer-narrowed-p))
> +                        (widen))))
>                   ,body
>                   (when was-narrowed (funcall #',narrowfun)))))))
>      (unless name (setq name base-name))
> 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 6 Feb 2023 17:16:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 06 12:16:36 2023
Received: from localhost ([127.0.0.1]:49767 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pP56a-0006YS-MS
	for submit <at> debbugs.gnu.org; Mon, 06 Feb 2023 12:16:36 -0500
Received: from relay8-d.mail.gandi.net ([217.70.183.201]:40493)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pP56Y-0006YA-Tr
 for 61215 <at> debbugs.gnu.org; Mon, 06 Feb 2023 12:16:35 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 2D2141BF20D;
 Mon,  6 Feb 2023 17:16:27 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <83mt5sq7nr.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 05 Feb
 2023 20:38:48 +0200")
Organization: LINKOV.NET
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
 <86bkmbfalm.fsf@HIDDEN> <83pmarufgi.fsf@HIDDEN>
 <86ilggc6gn.fsf@HIDDEN> <83mt5sq7nr.fsf@HIDDEN>
Date: Mon, 06 Feb 2023 19:15:49 +0200
Message-ID: <86edr2davu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 61215
Cc: 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> 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.

After debugging I discovered that the problem is not caused by font-lock
in diff-mode.  The problem is in easy-mmode-define-navigation.
diff-mode uses it to navigate diff hunks.  It supports such a feature
that when the user narrowed the diff buffer, it puts narrowing back
after moving to the next hunk.  But this fails when the diff buffer
is narrowed automatically by long-line-optimizations.  If there is
no way to distinguish whether the narrowing is automatic by long-lines
or manual by the user, this patch fixes the problem.  It works without
errors, and even highlights first 250000 characters of the long line:

diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 5721470ad0d..d9176061434 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -782,7 +782,10 @@ easy-mmode-define-navigation
          (when-narrowed
           (lambda (body)
             (if (null narrowfun) body
-              `(let ((was-narrowed (prog1 (buffer-narrowed-p) (widen))))
+              `(let ((was-narrowed
+                      (prog1 (unless (long-line-optimizations-p)
+                               (buffer-narrowed-p))
+                        (widen))))
                  ,body
                  (when was-narrowed (funcall #',narrowfun)))))))
     (unless name (setq name base-name))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 5 Feb 2023 18:38:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 05 13:38:48 2023
Received: from localhost ([127.0.0.1]:46444 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pOjua-0002CW-4Z
	for submit <at> debbugs.gnu.org; Sun, 05 Feb 2023 13:38:48 -0500
Received: from eggs.gnu.org ([209.51.188.92]:45052)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pOjuX-0002CI-BM
 for 61215 <at> debbugs.gnu.org; Sun, 05 Feb 2023 13:38:46 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pOjuR-0000NH-HM; Sun, 05 Feb 2023 13:38:39 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=j5Dq0WVc5wS2lHaennmh3EA0JLx9UgRo4n3FWC0uurA=; b=PJQh0ev21t3o
 a2bCdcFcxVZRcGGW1wJZnExlBbORwgoSu9bIjZEsgWnl4tiUMQ3B6i/1iw388h4SudcsDt5Ok+J5X
 ep1MZG9mejkWuQ79jj+VipAwn/TGlyWnVd/PCTIafEFRh3dwp0hkOsE+CRM592A9W6x5aT34LfBU6
 M8z9bZsN/+tStlgFOMqVc0bUb63t4H8ZjIaVbRqkDpZIub8BmUYJ89pQYntb3Hg5XzTaaRKs2WHB1
 T3XPPJtXGTmecuFGEIpsRgG6Vu4+CwlWE78A4w41PwlucHnlwR4E8u042jziBTT2kwcM7PR0QueDW
 uu4Ce2/leK/9hrA+f+uTYw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pOjuQ-0007LW-RL; Sun, 05 Feb 2023 13:38:39 -0500
Date: Sun, 05 Feb 2023 20:38:48 +0200
Message-Id: <83mt5sq7nr.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86ilggc6gn.fsf@HIDDEN> (message from Juri Linkov on
 Sun, 05 Feb 2023 20:28:24 +0200)
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
 <86bkmbfalm.fsf@HIDDEN> <83pmarufgi.fsf@HIDDEN>
 <86ilggc6gn.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 61215
Cc: 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: 61215 <at> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 5 Feb 2023 18:32:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 05 13:32:24 2023
Received: from localhost ([127.0.0.1]:46430 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pOjoN-00022I-PR
	for submit <at> debbugs.gnu.org; Sun, 05 Feb 2023 13:32:24 -0500
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:50353)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pOjoF-00021q-Ro
 for 61215 <at> debbugs.gnu.org; Sun, 05 Feb 2023 13:32:22 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id C88D31C0006;
 Sun,  5 Feb 2023 18:32:05 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <83pmarufgi.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 03 Feb
 2023 13:59:57 +0200")
Organization: LINKOV.NET
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
 <86bkmbfalm.fsf@HIDDEN> <83pmarufgi.fsf@HIDDEN>
Date: Sun, 05 Feb 2023 20:28:24 +0200
Message-ID: <86ilggc6gn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 61215
Cc: 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 3 Feb 2023 12:00:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 03 07:00:03 2023
Received: from localhost ([127.0.0.1]:36637 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pNujb-0000pI-37
	for submit <at> debbugs.gnu.org; Fri, 03 Feb 2023 07:00:03 -0500
Received: from eggs.gnu.org ([209.51.188.92]:36950)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pNujY-0000oH-Sf
 for 61215 <at> debbugs.gnu.org; Fri, 03 Feb 2023 07:00:01 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pNujS-0000M7-Mw; Fri, 03 Feb 2023 06:59:54 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=Kz5kW64pWNXmFBLIcjECdAGUJ/LJRz5E0fmoqTXYG48=; b=ViXlzGk4oQkutgdM4+zl
 ohGJyzZX2603EmC2+EEshFgQFdr9WIRTDt9XWPuhA+EB1rN0s9AYW1HlbNJnhiSUoBiIRgOA86lCq
 ql1SRYQMe22QhBvRJ2Z+oUEn3xbt5TI6EuM9MnNyq/3fMe/XMeyMkqB5DtkoRU05ziKS7busgmulA
 3LqW/B+aSdcYEutDLlVPaNmbkctjQ/PzdrZnxft4kYh5qjJRybgeMJhU0W9oTpH/lmILRJiIIW3xZ
 JGxB87pHEJA8S6NOSEysgPORjb+eoRoZ+pZW0dd6Z6EZpWzr5gdMwZzoJ61B8KL8X3F0t+LOZw/rr
 Nj8sI+mCeoNAgg==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pNujS-00065f-6P; Fri, 03 Feb 2023 06:59:54 -0500
Date: Fri, 03 Feb 2023 13:59:57 +0200
Message-Id: <83pmarufgi.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86bkmbfalm.fsf@HIDDEN> (message from Juri Linkov on
 Fri, 03 Feb 2023 09:53:57 +0200)
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
 <86bkmbfalm.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 61215
Cc: 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: 61215 <at> debbugs.gnu.org
> Date: Fri, 03 Feb 2023 09:53:57 +0200
> 
> >> 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?
> 
> Once you create such a commit, it's easy to reproduce this on it.

The recipe is quite complicated, doesn't include a file with the long
line that you used, and describes several steps in incomplete and
vague manner.  So it isn't so easy to reproduce for me, not really.
I'd probably need several attempts until I succeed, and the fact that
I need to create a repository just for this doesn't help (diff-mode is
not just for VCS diffs, right?)

If you can add the missing details and the file, it might be easier.

> > If so, does the patch below help?
> 
> Unfortunately, no.  Still such a backtrace:
> 
> Error: args-out-of-range (#<buffer *vc-diff*> 2000 1906)
>   mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0x12357049b0517812>))
>   debug-early-backtrace()
>   debug-early(error (args-out-of-range #<buffer *vc-diff*> 2000 1906))
>   buffer-substring-no-properties(2000 1906)
>   (let* ((hunk (buffer-substring-no-properties (max beg (point-min)) (min end (point-max)))) ...
>   diff-syntax-fontify-hunk(2000 250945 nil)
>   diff-syntax-fontify(2000 250945)
>   #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_39>(2000 250945)
>   diff--iterate-hunks(10000 #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_39>)
>   diff--font-lock-syntax(10000)

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))))
          ;; 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 3 Feb 2023 07:57:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 03 02:57:48 2023
Received: from localhost ([127.0.0.1]:36430 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pNqx9-0006jq-Pf
	for submit <at> debbugs.gnu.org; Fri, 03 Feb 2023 02:57:48 -0500
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:46251)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pNqx8-0006jR-F0
 for 61215 <at> debbugs.gnu.org; Fri, 03 Feb 2023 02:57:46 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 8D7E3E0003;
 Fri,  3 Feb 2023 07:57:38 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <83a61vx0jo.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 02 Feb
 2023 22:41:31 +0200")
Organization: LINKOV.NET
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN> <83a61vx0jo.fsf@HIDDEN>
Date: Fri, 03 Feb 2023 09:53:57 +0200
Message-ID: <86bkmbfalm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 61215
Cc: 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> 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?

Once you create such a commit, it's easy to reproduce this on it.

> If so, does the patch below help?

Unfortunately, no.  Still such a backtrace:

Error: args-out-of-range (#<buffer *vc-diff*> 2000 1906)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0x12357049b0517812>))
  debug-early-backtrace()
  debug-early(error (args-out-of-range #<buffer *vc-diff*> 2000 1906))
  buffer-substring-no-properties(2000 1906)
  (let* ((hunk (buffer-substring-no-properties (max beg (point-min)) (min end (point-max)))) ...
  diff-syntax-fontify-hunk(2000 250945 nil)
  diff-syntax-fontify(2000 250945)
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_39>(2000 250945)
  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 -0x156e2446868bfa03>)(font-lock-fontify-region)
  run-hook-wrapped(#f(compiled-function (fun) #<bytecode -0x156e2446868bfa03>) font-lock-fontify-region)
  jit-lock--run-functions(1527 3027)
  jit-lock-fontify-now(1527 3027)
  jit-lock-function(1527)
  redisplay_internal\ \(C\ function\)()




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 2 Feb 2023 20:41:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 02 15:41:38 2023
Received: from localhost ([127.0.0.1]:35931 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pNgOn-0002MR-RW
	for submit <at> debbugs.gnu.org; Thu, 02 Feb 2023 15:41:38 -0500
Received: from eggs.gnu.org ([209.51.188.92]:52318)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pNgOm-0002MD-Ac
 for 61215 <at> debbugs.gnu.org; Thu, 02 Feb 2023 15:41:36 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pNgOg-000598-GK; Thu, 02 Feb 2023 15:41:30 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=HjTv87y+0kyvdvTJDdn/9sbQSsFbh0uY3OhjSDdSQAY=; b=BPCFFKies9sTrDUuffj8
 piinqLqrNV7XHjjX6gjxEeXOdEV//rUfRjXglFqXOo16EQQyOHvBRTH4xr4M2jSARY1isRfGy1+up
 v/rSOUi1FcgcCweEtwLZWK/21ltaUxkbbdhBDGGCaOLCIOKRdKwBDxTFDY1IhgRWbmkkzo/+q0FuS
 HtH1KC2mVq7xvUKZS0sG06FU3vjH3ypvD+6SUkshGESIceufObGGg2rUkEo2WxOZSEIJI40OsRj1+
 6FAgML4Apl6LAmynOIjadBL7y9eSO8ZmJpY2FI2Hnnhs+4xJauOhto5YDscS0guuMr6PfMOO70/8m
 nQlOMyVXCMxzOA==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pNgOf-0007E5-98; Thu, 02 Feb 2023 15:41:30 -0500
Date: Thu, 02 Feb 2023 22:41:31 +0200
Message-Id: <83a61vx0jo.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86o7qcf2x5.fsf@HIDDEN> (message from Juri Linkov on
 Thu, 02 Feb 2023 19:16:34 +0200)
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
 <86o7qcf2x5.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 61215
Cc: 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: 61215 <at> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 2 Feb 2023 17:17:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 02 12:17:02 2023
Received: from localhost ([127.0.0.1]:35664 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pNdCo-0002vY-EN
	for submit <at> debbugs.gnu.org; Thu, 02 Feb 2023 12:17:02 -0500
Received: from relay11.mail.gandi.net ([217.70.178.231]:48993)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pNdCn-0002vD-6w
 for 61215 <at> debbugs.gnu.org; Thu, 02 Feb 2023 12:17:01 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 4D5CC10000F;
 Thu,  2 Feb 2023 17:16:53 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
In-Reply-To: <83cz6tz12b.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 01 Feb
 2023 20:35:08 +0200")
Organization: LINKOV.NET
References: <86lelh6yhq.fsf_-_@HIDDEN> <83cz6tz12b.fsf@HIDDEN>
Date: Thu, 02 Feb 2023 19:16:34 +0200
Message-ID: <86o7qcf2x5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 61215
Cc: 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> >> when there is at least one long line near the end of
>> >> a diff-mode buffer, then sometimes the buffer gets truncated,
>> >> 'diff-hunk-file-names' returns nil on diff headings,
>> >> and there are a lot of such errors in the Messages buffer:
>> >>
>> >>   Error during redisplay: (jit-lock-function 1) signaled (args-out-of-range #<buffer *vc-diff*> 1118 1370)
>> >
>> > We can and should fix this and other problems, but only if they are
>> > reported.  Would you please file a bug report for any such problem you
>> > find?
>>
>> This is a new bug report created from bug#56682.
>
> 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*

And *Redisplay_trace* contains:

Error: args-out-of-range (#<buffer *vc-diff*> 2000 251555)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x177cfe2073ae86a5>))
  debug-early-backtrace()
  debug-early(error (args-out-of-range #<buffer *vc-diff*> 2000 251555))
  buffer-substring-no-properties(2000 251555)
  diff-syntax-fontify-hunk(2000 251555 nil)
  diff-syntax-fontify(2000 251555)
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_39>(2000 251555)
  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 -0x156e6c38c061f903>)(font-lock-fontify-region)
  run-hook-wrapped(#f(compiled-function (fun) #<bytecode -0x156e6c38c061f903>) font-lock-fontify-region)
  jit-lock--run-functions(1527 3027)
  jit-lock-fontify-now(1527 3027)
  jit-lock-function(1527)
  redisplay_internal\ \(C\ function\)()




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at 61215 <at> debbugs.gnu.org:


Received: (at 61215) by debbugs.gnu.org; 1 Feb 2023 18:35:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 01 13:35:17 2023
Received: from localhost ([127.0.0.1]:59862 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pNHwy-0006qu-WC
	for submit <at> debbugs.gnu.org; Wed, 01 Feb 2023 13:35:17 -0500
Received: from eggs.gnu.org ([209.51.188.92]:46828)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pNHwx-0006qg-N0
 for 61215 <at> debbugs.gnu.org; Wed, 01 Feb 2023 13:35:16 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pNHws-0008CD-EE; Wed, 01 Feb 2023 13:35:10 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=/XXobWIpmo4GL+h/FKzXe0SBGxpufNr4RQW7DtJuqS4=; b=D9x7+iqFCw+8
 i25YXQCWCAQnBIA/IcegVIGWJPbPtveZqmrVfsZ01J0hsbBmQVFhMpXG3UGyTu/MclhIN20mGthr3
 Ak4YXC/o5iP1vmqny0l7ujJYHMxXuch/8ThXvEwXZpMTa8rIhuP+xD9U6OADPdryHfOtTsH7MOO5W
 H3y92vIW85t4CrQaManF52Yl3/d7tNmq5bdS1xXMdYMZehSOCDnNTskrUZ4Yv763MwJ/zY/nmZqLr
 qRaJfHHrEZWhg3NtvZ4czFEx1lpIhgyVbmjbFoVZN46Lby9OaFlpxA7+yZdo9F/o1erF7aREM8POa
 J8D+8JSL+1jBhsz6HrGwuw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pNHwq-0006Sj-4M; Wed, 01 Feb 2023 13:35:10 -0500
Date: Wed, 01 Feb 2023 20:35:08 +0200
Message-Id: <83cz6tz12b.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86lelh6yhq.fsf_-_@HIDDEN> (message from Juri Linkov on
 Wed, 01 Feb 2023 20:18:09 +0200)
Subject: Re: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
References: <86lelh6yhq.fsf_-_@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 61215
Cc: 61215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Date: Wed, 01 Feb 2023 20:18:09 +0200
> 
> >> when there is at least one long line near the end of
> >> a diff-mode buffer, then sometimes the buffer gets truncated,
> >> 'diff-hunk-file-names' returns nil on diff headings,
> >> and there are a lot of such errors in the Messages buffer:
> >>
> >>   Error during redisplay: (jit-lock-function 1) signaled (args-out-of-range #<buffer *vc-diff*> 1118 1370)
> >
> > We can and should fix this and other problems, but only if they are
> > reported.  Would you please file a bug report for any such problem you
> > find?
> 
> This is a new bug report created from bug#56682.

Thanks.  Can you post a recipe for reproducing that, preferably
starting from "emacs -Q"?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Feb 2023 18:20:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 01 13:20:10 2023
Received: from localhost ([127.0.0.1]:59825 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pNHiM-0006Qb-Dt
	for submit <at> debbugs.gnu.org; Wed, 01 Feb 2023 13:20:10 -0500
Received: from lists.gnu.org ([209.51.188.17]:50064)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1pNHiK-0006QU-Va
 for submit <at> debbugs.gnu.org; Wed, 01 Feb 2023 13:20:09 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1pNHi5-0004ho-0s
 for bug-gnu-emacs@HIDDEN; Wed, 01 Feb 2023 13:20:05 -0500
Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1pNHi1-0003oW-MQ
 for bug-gnu-emacs@HIDDEN; Wed, 01 Feb 2023 13:19:51 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id E0724240004
 for <bug-gnu-emacs@HIDDEN>; Wed,  1 Feb 2023 18:19:43 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.60; font-lock broken in diff-mode with long lines
Organization: LINKOV.NET
Date: Wed, 01 Feb 2023 20:18:09 +0200
Message-ID: <86lelh6yhq.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2001:4b98:dc4:8::221;
 envelope-from=juri@HIDDEN; helo=relay1-d.mail.gandi.net
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

>> when there is at least one long line near the end of
>> a diff-mode buffer, then sometimes the buffer gets truncated,
>> 'diff-hunk-file-names' returns nil on diff headings,
>> and there are a lot of such errors in the Messages buffer:
>>
>>   Error during redisplay: (jit-lock-function 1) signaled (args-out-of-range #<buffer *vc-diff*> 1118 1370)
>
> We can and should fix this and other problems, but only if they are
> reported.  Would you please file a bug report for any such problem you
> find?

This is a new bug report created from bug#56682.




Acknowledgement sent to Juri Linkov <juri@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#61215; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 1 Apr 2023 19:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.