From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii 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:38:48 +0200 Message-ID: <83mt5sq7nr.fsf@gnu.org> 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> <86ilggc6gn.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11346"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61215@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 05 19:39:17 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 1pOjv2-0002i7-Mh for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Feb 2023 19:39:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOjup-0001ZH-9v; Sun, 05 Feb 2023 13:39:03 -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 1pOjuo-0001Yo-EZ for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 13:39: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 1pOjuo-0000Pq-6j for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 13:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOjun-0002Cz-PG for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 13:39:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 18:39: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.16756223288468 (code B ref 61215); Sun, 05 Feb 2023 18:39:01 +0000 Original-Received: (at 61215) by debbugs.gnu.org; 5 Feb 2023 18:38:48 +0000 Original-Received: from localhost ([127.0.0.1]:46444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOjua-0002CW-4Z for submit@debbugs.gnu.org; Sun, 05 Feb 2023 13:38:48 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOjuX-0002CI-BM for 61215@debbugs.gnu.org; Sun, 05 Feb 2023 13:38:46 -0500 Original-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 ) 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==; Original-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 ) id 1pOjuQ-0007LW-RL; Sun, 05 Feb 2023 13:38:39 -0500 In-Reply-To: <86ilggc6gn.fsf@mail.linkov.net> (message from Juri Linkov on Sun, 05 Feb 2023 20:28:24 +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:254880 Archived-At: > From: Juri Linkov > Cc: 61215@debbugs.gnu.org > Date: Sun, 05 Feb 2023 20:28:24 +0200 > > > diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el > > index eb01ded..62db362 100644 > > --- a/lisp/vc/diff-mode.el > > +++ b/lisp/vc/diff-mode.el > > @@ -2762,7 +2762,10 @@ diff-syntax-fontify-hunk > > "Highlight source language syntax in diff hunk between BEG and END. > > When OLD is non-nil, highlight the hunk from the old source." > > (goto-char beg) > > - (let* ((hunk (buffer-substring-no-properties beg end)) > > + (let* ((hunk (buffer-substring-no-properties (min (max beg (point-min)) > > + (point-max)) > > + (max (min end (point-max)) > > + (point-min)))) > > Now a new error: > > Debugger entered--Lisp error: (error "Unknown diff hunk type") > signal(error ("Unknown diff hunk type")) > error("Unknown diff hunk type") > diff-hunk-text("" t nil) > diff-syntax-fontify-hunk(2000 250992 nil) > diff-syntax-fontify(2000 250992) > #(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. 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.