From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#61215: 29.0.60; font-lock broken in diff-mode with long lines Date: Sun, 05 Feb 2023 20:28:24 +0200 Organization: LINKOV.NET Message-ID: <86ilggc6gn.fsf@mail.linkov.net> References: <86lelh6yhq.fsf_-_@mail.linkov.net> <83cz6tz12b.fsf@gnu.org> <86o7qcf2x5.fsf@mail.linkov.net> <83a61vx0jo.fsf@gnu.org> <86bkmbfalm.fsf@mail.linkov.net> <83pmarufgi.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21343"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 61215@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 05 19:33:13 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pOjpB-0005Qu-8G for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Feb 2023 19:33:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOjp2-0008GG-Kc; Sun, 05 Feb 2023 13:33:04 -0500 Original-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 ) id 1pOjp0-0008G2-Hv for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 13:33:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOjp0-0007oD-6C for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 13:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOjoz-00023E-SQ for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 13:33:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 18:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61215 X-GNU-PR-Package: emacs Original-Received: via spool by 61215-submit@debbugs.gnu.org id=B61215.16756219447834 (code B ref 61215); Sun, 05 Feb 2023 18:33:01 +0000 Original-Received: (at 61215) by debbugs.gnu.org; 5 Feb 2023 18:32:24 +0000 Original-Received: from localhost ([127.0.0.1]:46430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOjoN-00022I-PR for submit@debbugs.gnu.org; Sun, 05 Feb 2023 13:32:24 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:50353) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOjoF-00021q-Ro for 61215@debbugs.gnu.org; Sun, 05 Feb 2023 13:32:22 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id C88D31C0006; Sun, 5 Feb 2023 18:32:05 +0000 (UTC) In-Reply-To: <83pmarufgi.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 03 Feb 2023 13:59:57 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254879 Archived-At: > 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) #(2000 250992) diff--iterate-hunks(10000 #) 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) #)(font-lock-fontify-region) run-hook-wrapped(#f(compiled-function (fun) #) 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.