From unknown Fri Aug 15 20:02:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60660: Support git-formatted patches in diff-mode Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jan 2023 18:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60660 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 60660@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167320256532140 (code B ref -1); Sun, 08 Jan 2023 18:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 8 Jan 2023 18:29:25 +0000 Received: from localhost ([127.0.0.1]:34637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEaQ9-0008MH-GO for submit@debbugs.gnu.org; Sun, 08 Jan 2023 13:29:25 -0500 Received: from lists.gnu.org ([209.51.188.17]:36570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEaQ7-0008M5-LR for submit@debbugs.gnu.org; Sun, 08 Jan 2023 13:29:24 -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 ) id 1pEaQ7-0002ky-GK for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2023 13:29:23 -0500 Received: from relay10.mail.gandi.net ([2001:4b98:dc4:8::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEaQ2-0004QU-Sj for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2023 13:29:21 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 2A4E5240007 for ; Sun, 8 Jan 2023 18:29:15 +0000 (UTC) From: Juri Linkov Organization: LINKOV.NET Date: Sun, 08 Jan 2023 20:21:23 +0200 Message-ID: <86mt6ssx98.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2001:4b98:dc4:8::230; envelope-from=juri@linkov.net; helo=relay10.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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Currently, there is a lot of misfontification in diff-mode visiting a git patch. Two dashes in the signature separator are highlighted with the diff-removed face (the existing diff-prev-line-if-patch-separator is used for something else). Three dashes in the git patch header that separate a list of affected files are highlighted with the diff-hunk-header face, etc. But the worst case that raises an error is when an exclamation mark is used at the beginning of the line in the git patch message. This patch for emacs-29 fixes this bug, and the rest of fontification could be implemented in master. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=diff-font-lock-changed.patch diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index acfd2c30f0c..eb01dede56e 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -485,17 +485,19 @@ diff-font-lock-keywords ;; if below, use `diff-added'. (save-match-data (let ((limit (save-excursion (diff-beginning-of-hunk)))) - (if (save-excursion (re-search-backward diff-context-mid-hunk-header-re limit t)) - diff-indicator-added-face - diff-indicator-removed-face))))) + (when (< limit (point)) + (if (save-excursion (re-search-backward diff-context-mid-hunk-header-re limit t)) + diff-indicator-added-face + diff-indicator-removed-face)))))) (2 (if diff-use-changed-face 'diff-changed-unspecified ;; Otherwise, use the same method as above. (save-match-data (let ((limit (save-excursion (diff-beginning-of-hunk)))) - (if (save-excursion (re-search-backward diff-context-mid-hunk-header-re limit t)) - 'diff-added - 'diff-removed)))))) + (when (< limit (point)) + (if (save-excursion (re-search-backward diff-context-mid-hunk-header-re limit t)) + 'diff-added + 'diff-removed))))))) ("^\\(?:Index\\|revno\\): \\(.+\\).*\n" (0 'diff-header) (1 'diff-index prepend)) ("^\\(?:index .*\\.\\.\\|diff \\).*\n" . 'diff-header) --=-=-=-- From unknown Fri Aug 15 20:02:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60660: Support git-formatted patches in diff-mode Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jan 2023 18:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60660 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Juri Linkov Cc: 60660@debbugs.gnu.org Received: via spool by 60660-submit@debbugs.gnu.org id=B60660.167320386720240 (code B ref 60660); Sun, 08 Jan 2023 18:52:02 +0000 Received: (at 60660) by debbugs.gnu.org; 8 Jan 2023 18:51:07 +0000 Received: from localhost ([127.0.0.1]:34719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEal8-0005GO-MA for submit@debbugs.gnu.org; Sun, 08 Jan 2023 13:51:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60050) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEal6-0005Ft-SO for 60660@debbugs.gnu.org; Sun, 08 Jan 2023 13:51:05 -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 ) id 1pEal1-0002M6-29; Sun, 08 Jan 2023 13:50:59 -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=k5IWAe+aXe3YCbdD5ifq30anKOgjX4uLaSedq16f7wc=; b=bFUUwvK6RWhb DI7Vwwhh/nA+9baZbZAkRGceFc66v8/W5jaPQM7zUKVnmcr6qEM94hB3EiahfZmrhw30VXOpTfw3w 4DDEM4N/I5X7sMQoW/hIJe1E6nxM2doqVxOBDEhvMO4eZaa1jHSdpW/exrycY6udRFK5UCK7I5gHI vru1dxyG+e8Zb2mTHQ1l5pyC6+wSRFFDSfft1bXVWkjAMG/AMx9T+ZeopwkVY29mszaWEWMgTQ7Ay WrRPslNU2VljE4939j5ESmNOjVYcKW5pmtPhyKlJvFT3BuDML23fqZC+apSIVoLgEaIMtPIO9LzTe 00j7aHFT4mGxniWcmG7Uuw==; 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 1pEal0-0006K5-8d; Sun, 08 Jan 2023 13:50:58 -0500 Date: Sun, 08 Jan 2023 20:51:22 +0200 Message-Id: <83h6x0q2qd.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <86mt6ssx98.fsf@mail.linkov.net> (message from Juri Linkov on Sun, 08 Jan 2023 20:21:23 +0200) References: <86mt6ssx98.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Juri Linkov > Date: Sun, 08 Jan 2023 20:21:23 +0200 > > Currently, there is a lot of misfontification in diff-mode visiting a git patch. > Two dashes in the signature separator are highlighted with the diff-removed face > (the existing diff-prev-line-if-patch-separator is used for something else). > Three dashes in the git patch header that separate a list of affected files > are highlighted with the diff-hunk-header face, etc. > > But the worst case that raises an error is when an exclamation mark is used > at the beginning of the line in the git patch message. > > This patch for emacs-29 fixes this bug, and the rest of fontification > could be implemented in master. OK for the emacs-29 branch (although I'm surprised that diff-beginning-of-hunk can return a position that is not before point). Thanks. From unknown Fri Aug 15 20:02:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60660: Support git-formatted patches in diff-mode Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Jan 2023 07:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60660 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 60660@debbugs.gnu.org Received: via spool by 60660-submit@debbugs.gnu.org id=B60660.167325097417008 (code B ref 60660); Mon, 09 Jan 2023 07:57:02 +0000 Received: (at 60660) by debbugs.gnu.org; 9 Jan 2023 07:56:14 +0000 Received: from localhost ([127.0.0.1]:35684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEn0v-0004QG-Mk for submit@debbugs.gnu.org; Mon, 09 Jan 2023 02:56:13 -0500 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:40539) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEn0s-0004Po-SJ for 60660@debbugs.gnu.org; Mon, 09 Jan 2023 02:56:11 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id A8040FF803; Mon, 9 Jan 2023 07:56:02 +0000 (UTC) From: Juri Linkov In-Reply-To: <83h6x0q2qd.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 08 Jan 2023 20:51:22 +0200") Organization: LINKOV.NET References: <86mt6ssx98.fsf@mail.linkov.net> <83h6x0q2qd.fsf@gnu.org> Date: Mon, 09 Jan 2023 09:54:54 +0200 Message-ID: <86358k6t2p.fsf@mail.linkov.net> 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> This patch for emacs-29 fixes this bug, and the rest of fontification >> could be implemented in master. > > OK for the emacs-29 branch Pushed to the emacs-29 branch. > (although I'm surprised that diff-beginning-of-hunk can return > a position that is not before point). Indeed, strange to see this in 'diff-beginning-of-hunk': (cond ... ((re-search-backward regexp nil t)) ; In the middle of a hunk. ((re-search-forward regexp nil t) ; At first hunk header. ======= Need to experiment more with this in master. From unknown Fri Aug 15 20:02:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60660: Support git-formatted patches in diff-mode Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Sep 2023 23:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60660 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Juri Linkov Cc: Eli Zaretskii , 60660@debbugs.gnu.org Received: via spool by 60660-submit@debbugs.gnu.org id=B60660.16939566588345 (code B ref 60660); Tue, 05 Sep 2023 23:31:01 +0000 Received: (at 60660) by debbugs.gnu.org; 5 Sep 2023 23:30:58 +0000 Received: from localhost ([127.0.0.1]:59800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdfVa-0002AX-8z for submit@debbugs.gnu.org; Tue, 05 Sep 2023 19:30:58 -0400 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]:57706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdfVW-0002AE-2J for 60660@debbugs.gnu.org; Tue, 05 Sep 2023 19:30:57 -0400 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2bd0d135ca3so52114141fa.3 for <60660@debbugs.gnu.org>; Tue, 05 Sep 2023 16:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693956647; x=1694561447; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=BJLw8pHjRSTJfX319K9wgNn65Czt++cYPJGNP5nhR2I=; b=rBJG7R+Ew6ybeVT7DyqSkhrzeG0OO9FrBdKLUXpqZf9ph9EshcHKd45e9Oh9VeDRnG kRX6JsJ63P7eIP/ghlTbAqEgPU/o0HfbE6Iglhc596AT+lsu4EAxb9SPl79rB5JOr2Lk uBdO0zDQ4GugS7g7zHNKEPBx2MXDeqtdBi7fjyJP4EBzE1sCJV51TGLm7MUX237xTzbS gdlLivWPRUANwSIeQensFMTvBEk000k4ydr6FyxQBGJBdZ/PGy2E/xuG9Nn/FcfR/l1A pivh1wTO9K5DQouSSh77aOPfPtQHF3RG0Mh7uqr6157pqXsoBfWbpTifkp6jVU4gBsiL e9Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693956647; x=1694561447; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BJLw8pHjRSTJfX319K9wgNn65Czt++cYPJGNP5nhR2I=; b=jjaFj1sbEDhLlnFfQ3arPFPGA8PfNR50BsFA7vxBKgtOAEBUnIoZ/fTrrnOHiZm1LX 863z/61MywNvUK5rZaMOe0o0WqzcLa+5ogRlIJ7sLddKJhFXdLJQR4+SzyOnNdjrewzZ kSkon8RDHKrKqd/JwbC5DtP8l0eI07LybQy1zSAkphzq0LUqqpj+birh2qJxcJ/mbEPP X2lPsU4K4VXNwNKHhm3HyrLMvJXbqHODoUvmBzWguWGoRnEXSfa3mnKHYo2y9x/qEorA r30JCuoQlcSvUXimZU5e8oU5mQ67X8j7xW3hu/SiVJmQLYDTyT8UVgocfQ304EWrrUQ8 22zA== X-Gm-Message-State: AOJu0YwZZZwY5wrYnFdliKcSlGwZezB28b2blrlAon/hx2MN64GDizJH Mvzp6cW6hKE+Tbmy54cLLkVrCZWMy4tGbeBh5rg= X-Google-Smtp-Source: AGHT+IHNnaWrbQLHBYFjmNt7R2jEhbsw6PITUiXRyKBEcnjEOEArjyBK3bYrTUB0y/HRXMkMZsoh9UIUsZiYpYh3z60= X-Received: by 2002:a05:6512:2820:b0:4ff:9efd:8a9e with SMTP id cf32-20020a056512282000b004ff9efd8a9emr1095615lfb.7.1693956647221; Tue, 05 Sep 2023 16:30:47 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 5 Sep 2023 16:30:46 -0700 From: Stefan Kangas In-Reply-To: <86358k6t2p.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 09 Jan 2023 09:54:54 +0200") References: <86mt6ssx98.fsf@mail.linkov.net> <83h6x0q2qd.fsf@gnu.org> <86358k6t2p.fsf@mail.linkov.net> MIME-Version: 1.0 Date: Tue, 5 Sep 2023 16:30:46 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: >>> This patch for emacs-29 fixes this bug, and the rest of fontification >>> could be implemented in master. >> >> OK for the emacs-29 branch > > Pushed to the emacs-29 branch. So is there more to do here, or should this bug be closed? I'm not sure if it's still needed to track the below. >> (although I'm surprised that diff-beginning-of-hunk can return >> a position that is not before point). > > Indeed, strange to see this in 'diff-beginning-of-hunk': > > (cond ... > ((re-search-backward regexp nil t)) ; In the middle of a hunk. > ((re-search-forward regexp nil t) ; At first hunk header. > ======= > > Need to experiment more with this in master. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 08 07:44:34 2023 Received: (at control) by debbugs.gnu.org; 8 Sep 2023 11:44:34 +0000 Received: from localhost ([127.0.0.1]:42406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qeZuc-00080G-7Y for submit@debbugs.gnu.org; Fri, 08 Sep 2023 07:44:34 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:53526) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qeZua-000803-Kk for control@debbugs.gnu.org; Fri, 08 Sep 2023 07:44:33 -0400 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-50091b91a83so3203318e87.3 for ; Fri, 08 Sep 2023 04:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694173464; x=1694778264; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=0LBCJreTFBbxccoYQRhf/QRKpzeQMckGzIwj2u6AhfM=; b=qfwuJ9KHczrpaNsF3iLDxjxNLjOOlv+esvK8eaUNKNloj+xtLHai58p571wCWxrD3+ V8arPPVo5QwuYaE612Bz2pQ9+K4yEjB+ILPF4wFf/yckliRP3E1ZuMxqR6gXaZYgfZM3 8mcEVHb43kMm5DxVENTLrdDCxGhGuO8w1XuQnX22dVDubnClsj6cd2OPSXq7U1oh9T/s QjlmPDDVJXo8L8yh2BkpD5SZNgpWZ61jyk63RioPWht46xEoQP+uzHwqzpjlpfA3VcoC /X30uMht+cocM7OeKCkadxpi9zEyLZv4UoRFongEce4p64p8L4RZE0e1BZd9ys9IDx2c PdxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694173464; x=1694778264; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0LBCJreTFBbxccoYQRhf/QRKpzeQMckGzIwj2u6AhfM=; b=tFSgM3uE82EFjmZezuSQfFqvafAwF6Sci9LQlz+2lA8ihmC3aesRcFcLBxTup6HF3W VFqnVcCBM2DycKB8BMvT/BBfWmWaOc7wMIe54FK/Db8hiqWVObzFWs5UtRQgsiG2iZO5 4HXgMVX/KugLEGEtGS+05VNUDbdVVEFj6LAH1pUMWFd0u3Ilih3kLNCyjahlus3uS2T2 qqirh+Tq2exQS7wYjSTvFHVJRnQkTeopUf8+mtFsTWIBHE7/FaCPL8xzQi+SQKuow9FH Ij1aODK8XF/O7mFEOXN1Vq3WsDl0u2yye1hnuBXRUh0IS6kY9aw1XWiZm7OEnoJiwmKj 0uDA== X-Gm-Message-State: AOJu0YwiEruIz2Jl2UTvMsiNLhUe5p91CWZRg0SvmsY2z2c5QeWG6+Yd Nv32+5v7SqBH+n80BlaEUnuWeg1OBBmL8NxUNBpS2uwg X-Google-Smtp-Source: AGHT+IGeefcDMIvot7z67veO90BJaWi28KlhSD3ySBzsIkHJCbC2799HE7RmQ7vaOFY68/Y4hEK7JhH80FpoRpWcJh8= X-Received: by 2002:a19:914a:0:b0:4fa:da4f:636f with SMTP id y10-20020a19914a000000b004fada4f636fmr1372014lfj.32.1694173463966; Fri, 08 Sep 2023 04:44:23 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 8 Sep 2023 04:44:23 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Fri, 8 Sep 2023 04:44:23 -0700 Message-ID: Subject: control message for bug #60660 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 60660 + patch quit From unknown Fri Aug 15 20:02:19 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Juri Linkov Subject: bug#60660: closed (Re: bug#60660: Support git-formatted patches in diff-mode) Message-ID: References: <86mt6ssx98.fsf@mail.linkov.net> X-Gnu-PR-Message: they-closed 60660 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 60660@debbugs.gnu.org Date: Wed, 10 Jan 2024 22:38:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1704926282-9591-1" This is a multi-part message in MIME format... ------------=_1704926282-9591-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #60660: Support git-formatted patches in diff-mode which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 60660@debbugs.gnu.org. --=20 60660: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D60660 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1704926282-9591-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 60660-done) by debbugs.gnu.org; 10 Jan 2024 22:37:59 +0000 Received: from localhost ([127.0.0.1]:43497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNhCx-0002UO-3z for submit@debbugs.gnu.org; Wed, 10 Jan 2024 17:37:59 -0500 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:43078) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNhCv-0002UB-BR for 60660-done@debbugs.gnu.org; Wed, 10 Jan 2024 17:37:58 -0500 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-557bfc7f7b4so6043401a12.0 for <60660-done@debbugs.gnu.org>; Wed, 10 Jan 2024 14:37:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704926273; x=1705531073; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=tR2M24DKxDTdKlaxSGFTYjf2jhCUDSdm9h5rMspHdjI=; b=eaaXTXQ34dvCzSZ7xXSdktJ2CwSUh3qDXHH3JOrz2ZjOsYF3ackrA87ZJBz0XVoaNd KlwcEcF+yKkJsPgIepFaKE8gF9sUo7mCMsifKUhEgf6fI5UjxFGI7u6kFErPeECqb5QX OuTHg/pcfbL3CeOQ7RP9f89IgxUx7lw9qR29zhiDd04RrvujkCfF7UccoOsH5pzWMnO7 bnNVS7eORYdd+yDsMPrR4u1U6fhY5ecFqBRlMAY1M/MZKITJEe4oJjoXsfYdbiSWg9xd 9DYv3FReB0+yYiGKDFzeKGoZNPMP7kWswKvmJfKryjp5SJlSbzyELsPbw5dn8/N3yCic j5uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704926273; x=1705531073; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tR2M24DKxDTdKlaxSGFTYjf2jhCUDSdm9h5rMspHdjI=; b=SiWzTRgsmx3jh/7k4o0Wlu8YxYkOvpqHo+Qot5Qi4lseYOF7C0lWsm0BJhVp/cfjM7 rlcO5+61eKjTxURwZ7kd+njzlQ/10UeBa3uT2rICbY6QkM17XJkoZSPTWN/x1kvuHZfo VsLJcct7xQZARJrRW5Oq2+q8KfZz58S7rrXkW2jjMXwNYh6up69b0ul6ynSZ0yFBweAy mHIudVYJnp2O5cDXD0GUnhtgs4rxDivf9m7pfGac72kacU6s5fvJOavao2PbKlN1ww+9 Fqf3YxiaVOiStFes0BrOFFHEhw0kKMwx3Lv/WMPvC43j51EPWiCRRpphq9F21FD5wwqU vpOQ== X-Gm-Message-State: AOJu0Ywi4kJDBIq+MF4jpZ9H9Ur2igDZkRP9e4Hm8btY4Sbh7/XW+OCl 8FVLBxcy+H/SRmhPEdLZhJ32ArHpICqVuBVDBAE= X-Google-Smtp-Source: AGHT+IGIPt83EqSpSOA45qo7g/bUc5WofZK4yXYrSDHn2Sl9n3PqeIrRm9ZnN+DPsQv/pCzXsK5YWxAt4IWE93XIcqU= X-Received: by 2002:a05:6402:503:b0:556:d522:89b6 with SMTP id m3-20020a056402050300b00556d52289b6mr147523edv.32.1704926272722; Wed, 10 Jan 2024 14:37:52 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 10 Jan 2024 14:37:52 -0800 From: Stefan Kangas In-Reply-To: (Stefan Kangas's message of "Tue, 5 Sep 2023 16:30:46 -0700") References: <86mt6ssx98.fsf@mail.linkov.net> <83h6x0q2qd.fsf@gnu.org> <86358k6t2p.fsf@mail.linkov.net> MIME-Version: 1.0 Date: Wed, 10 Jan 2024 14:37:52 -0800 Message-ID: Subject: Re: bug#60660: Support git-formatted patches in diff-mode To: Juri Linkov Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60660-done Cc: Eli Zaretskii , 60660-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Kangas writes: > Juri Linkov writes: > >>>> This patch for emacs-29 fixes this bug, and the rest of fontification >>>> could be implemented in master. >>> >>> OK for the emacs-29 branch >> >> Pushed to the emacs-29 branch. > > So is there more to do here, or should this bug be closed? I'm not sure > if it's still needed to track the below. > >>> (although I'm surprised that diff-beginning-of-hunk can return >>> a position that is not before point). >> >> Indeed, strange to see this in 'diff-beginning-of-hunk': >> >> (cond ... >> ((re-search-backward regexp nil t)) ; In the middle of a hunk. >> ((re-search-forward regexp nil t) ; At first hunk header. >> ======= >> >> Need to experiment more with this in master. No further comments, so I'm closing this now. Please reopen if it's needed to track the above. ------------=_1704926282-9591-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 8 Jan 2023 18:29:25 +0000 Received: from localhost ([127.0.0.1]:34637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEaQ9-0008MH-GO for submit@debbugs.gnu.org; Sun, 08 Jan 2023 13:29:25 -0500 Received: from lists.gnu.org ([209.51.188.17]:36570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEaQ7-0008M5-LR for submit@debbugs.gnu.org; Sun, 08 Jan 2023 13:29:24 -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 ) id 1pEaQ7-0002ky-GK for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2023 13:29:23 -0500 Received: from relay10.mail.gandi.net ([2001:4b98:dc4:8::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEaQ2-0004QU-Sj for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2023 13:29:21 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 2A4E5240007 for ; Sun, 8 Jan 2023 18:29:15 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: Support git-formatted patches in diff-mode Organization: LINKOV.NET Date: Sun, 08 Jan 2023 20:21:23 +0200 Message-ID: <86mt6ssx98.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2001:4b98:dc4:8::230; envelope-from=juri@linkov.net; helo=relay10.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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Currently, there is a lot of misfontification in diff-mode visiting a git patch. Two dashes in the signature separator are highlighted with the diff-removed face (the existing diff-prev-line-if-patch-separator is used for something else). Three dashes in the git patch header that separate a list of affected files are highlighted with the diff-hunk-header face, etc. But the worst case that raises an error is when an exclamation mark is used at the beginning of the line in the git patch message. This patch for emacs-29 fixes this bug, and the rest of fontification could be implemented in master. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=diff-font-lock-changed.patch diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index acfd2c30f0c..eb01dede56e 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -485,17 +485,19 @@ diff-font-lock-keywords ;; if below, use `diff-added'. (save-match-data (let ((limit (save-excursion (diff-beginning-of-hunk)))) - (if (save-excursion (re-search-backward diff-context-mid-hunk-header-re limit t)) - diff-indicator-added-face - diff-indicator-removed-face))))) + (when (< limit (point)) + (if (save-excursion (re-search-backward diff-context-mid-hunk-header-re limit t)) + diff-indicator-added-face + diff-indicator-removed-face)))))) (2 (if diff-use-changed-face 'diff-changed-unspecified ;; Otherwise, use the same method as above. (save-match-data (let ((limit (save-excursion (diff-beginning-of-hunk)))) - (if (save-excursion (re-search-backward diff-context-mid-hunk-header-re limit t)) - 'diff-added - 'diff-removed)))))) + (when (< limit (point)) + (if (save-excursion (re-search-backward diff-context-mid-hunk-header-re limit t)) + 'diff-added + 'diff-removed))))))) ("^\\(?:Index\\|revno\\): \\(.+\\).*\n" (0 'diff-header) (1 'diff-index prepend)) ("^\\(?:index .*\\.\\.\\|diff \\).*\n" . 'diff-header) --=-=-=-- ------------=_1704926282-9591-1--