Received: (at 73332) by debbugs.gnu.org; 21 Sep 2024 14:13:31 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 21 10:13:31 2024 Received: from localhost ([127.0.0.1]:40085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ss0ra-0002K6-Oo for submit <at> debbugs.gnu.org; Sat, 21 Sep 2024 10:13:31 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:20904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1ss0rZ-0002Jp-7i for 73332 <at> debbugs.gnu.org; Sat, 21 Sep 2024 10:13:29 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id DF0C544149E; Sat, 21 Sep 2024 10:13:02 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1726927981; bh=OdymecR3MW+JtSSddpT0qIIRs271IygjvD7j/YVuvgM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=D/2ShwHFs0qg/amvV7M6t13+4LBZiJmMg4eaaylJLJC/LwGKeYUDCkOGVNxBlmJzj HbOxsTz6jEAcS/GjVx0hLgSsGjLruZyr0gno11lPD3sCF3eONMugkYCH06zzOH6DF5 0kRhcDgHxd3/C0bdYndTTb6Wl0Jq5x1gS0nqQ1CxiILDJiyD1E3mQyNBew3PdMYUXK koCPUptsx0VniTk4Yqk0lkRKRHADrv53yHNsyggyxF9R7VIE7pzwke3Dnm71y5blOG dDF56UyMRFPWWAaay59PrMh3aeeLcaMIPEHG9f1py8Yc/TRMPSiIatRr8b/AdDAlD3 /MItv6A1OuANw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id DB551441318; Sat, 21 Sep 2024 10:13:01 -0400 (EDT) Received: from asado (unknown [142.137.40.116]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C71141204C5; Sat, 21 Sep 2024 10:13:01 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#73332: 31.0.50; Whitespace-mode breaking font-locking In-Reply-To: <861q1d46yh.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 21 Sep 2024 13:49:42 +0300") Message-ID: <jwvcykxyu29.fsf-monnier+emacs@HIDDEN> References: <9e04c81c-d95f-434f-aae7-6b65664bc479@HIDDEN> <86y13o7z7q.fsf@HIDDEN> <jwved5f4ptr.fsf-monnier+emacs@HIDDEN> <861q1d46yh.fsf@HIDDEN> Date: Sat, 21 Sep 2024 10:13:01 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73332 Cc: rhansen@HIDDEN, 73332 <at> debbugs.gnu.org, jc+o.emacs@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: -3.3 (---) > Thanks. I installed on the the change in your name (in addition to my > part,macs-30 branch which fixes refontification of the last character > at EOB when point moves). I hope I didn't misunderstand you, and > removing OVERRIDE in that one place together with using 'prepend' will > not cause any unintended consequences. LGTM, thank you, Stefan
bug-gnu-emacs@HIDDEN
:bug#73332
; Package emacs
.
Full text available.Received: (at 73332) by debbugs.gnu.org; 21 Sep 2024 10:50:21 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 21 06:50:21 2024 Received: from localhost ([127.0.0.1]:37418 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1srxgw-0007Fh-52 for submit <at> debbugs.gnu.org; Sat, 21 Sep 2024 06:50:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1srxgt-0007FR-Bm for 73332 <at> debbugs.gnu.org; Sat, 21 Sep 2024 06:50:16 -0400 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 1srxgR-0007BZ-Pt; Sat, 21 Sep 2024 06:49:47 -0400 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=w+ApMK8mhGdFU4gYJRT8x7QOLB0dzjyGgF5SfuLWHKo=; b=seZNNSyBECNq Zk/+kp9mFh/rhQz4t5wAWrFdViq/VLAgd2fgRrgSGq6zh4vinMSi8T8vy+g2UAkLkT0CwVHxfBC2Q z1qBgM4rwfer5YnOemDAG/F65I9Yue4jY8BSGxstlHRwizHnArNZ4Dxm2aQ6eLYet2e3PfJOQny7h cmsVKBguZbcaVTakHx6GxNtZMNxJvXiK71rkvdTrU1e5VApdnM8iDAzU+4R7A3OP8ukFxptL6BHM8 MTFxm3YOvBbBUrtmP9NkCM2gurjZbkdgi9xw3CUXLAHq8YP+HXI5scQQJLDOFQ5TljHjZSLf4rCFr Eq+98LTBQL1+6tXV/QlrNA==; Date: Sat, 21 Sep 2024 13:49:42 +0300 Message-Id: <861q1d46yh.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> In-Reply-To: <jwved5f4ptr.fsf-monnier+emacs@HIDDEN> (message from Stefan Monnier on Thu, 19 Sep 2024 11:50:26 -0400) Subject: Re: bug#73332: 31.0.50; Whitespace-mode breaking font-locking References: <9e04c81c-d95f-434f-aae7-6b65664bc479@HIDDEN> <86y13o7z7q.fsf@HIDDEN> <jwved5f4ptr.fsf-monnier+emacs@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73332 Cc: rhansen@HIDDEN, 73332 <at> debbugs.gnu.org, jc+o.emacs@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: -3.3 (---) > From: Stefan Monnier <monnier@HIDDEN> > Cc: Jordan Ellis Coppard <jc+o.emacs@HIDDEN>, Richard Hansen > <rhansen@HIDDEN>, 73332 <at> debbugs.gnu.org > Date: Thu, 19 Sep 2024 11:50:26 -0400 > > But personally I think the root cause is the use of OVERRIDE and I'd > replace it with `prepend` as in the patch below, but whitespace uses > OVERRIDE "everywhere", whereas my argument would suggest it should use > `prepend` at all those places, which is likely beyond the scope of `emacs-30`. Thanks. I installed on the the change in your name (in addition to my part,macs-30 branch which fixes refontification of the last character at EOB when point moves). I hope I didn't misunderstand you, and removing OVERRIDE in that one place together with using 'prepend' will not cause any unintended consequences.
bug-gnu-emacs@HIDDEN
:bug#73332
; Package emacs
.
Full text available.Received: (at 73332) by debbugs.gnu.org; 19 Sep 2024 15:51:00 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 11:51:00 2024 Received: from localhost ([127.0.0.1]:33301 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1srJQp-00077q-VO for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 11:51:00 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1srJQn-00077Y-Lt for 73332 <at> debbugs.gnu.org; Thu, 19 Sep 2024 11:50:58 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9CE6A4425B4; Thu, 19 Sep 2024 11:50:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1726761027; bh=+IrriltIytSCZ+xewbxs6tfSIux2xLA92u5O3MVCnQ0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=K9ibO8fa1v/I8wjTt4jNeTL96ghgjj6mlwU5VgpWpLqGNRUzkH3zyIin2sXra26Xj FHD621ZmXDYv1PD6o6KjKWnG6pe5JkLjwc2KgOYvCR6HG2M9/bYs5vLqhSltlzhP/6 UORb0bl2vrXrfp3z6P6GqfGkjV+6RocDMohZBxG5mRiQJwAtFC9k5N5Wg3LW11WKmM zTsMiNyRZFlOefYa4ZOTP9kaNnkPrvAkUwowHRwDiHGWX9JkLIbZDgwV94tGoad9Lz QDjWLj/8oQMU7tQaNVBI4lhRwnUQt5ucLwlMfmhrkJ+B1SFsp/4W4hsBjH4KGZt9Wx cXE0ojlQtdsxA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 793474425AF; Thu, 19 Sep 2024 11:50:27 -0400 (EDT) Received: from asado (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4964E12038D; Thu, 19 Sep 2024 11:50:27 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#73332: 31.0.50; Whitespace-mode breaking font-locking In-Reply-To: <86y13o7z7q.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 19 Sep 2024 12:46:33 +0300") Message-ID: <jwved5f4ptr.fsf-monnier+emacs@HIDDEN> References: <9e04c81c-d95f-434f-aae7-6b65664bc479@HIDDEN> <86y13o7z7q.fsf@HIDDEN> Date: Thu, 19 Sep 2024 11:50:26 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.115 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73332 Cc: Richard Hansen <rhansen@HIDDEN>, 73332 <at> debbugs.gnu.org, Jordan Ellis Coppard <jc+o.emacs@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: -3.3 (---) --=-=-= Content-Type: text/plain > Stefan, is there a way of avoiding this effect, perhaps by using a > function in whitespace-font-lock-keywords? We could of course replace the regexp with a function and thus do "whatever we want", as in: ,@(when (memq 'missing-newline-at-eof whitespace-active-style) ;; Show missing newline. `(,(lambda (limit) (when (and (re-search-forward ".\\'" nil t) ;; Don't mark the end of the buffer if point is ;; there -- it probably means that the user is ;; typing something at the end of the buffer. (/= whitespace-point (point-max))) (put-text-property (match-beginning 0) (match-end 0) 'face 'whitespace-missing-newline-at-eof) nil)))) But personally I think the root cause is the use of OVERRIDE and I'd replace it with `prepend` as in the patch below, but whitespace uses OVERRIDE "everywhere", whereas my argument would suggest it should use `prepend` at all those places, which is likely beyond the scope of `emacs-30`. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=whitespace.patch diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 28d131b054c..3693125ec7b 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -739,7 +739,7 @@ whitespace-space-before-tab-regexp (defcustom whitespace-indentation-regexp '("^\t*\\(\\( \\{%d\\}\\)+\\)[^\n\t]" - . "^ *\\(\t+\\)[^\n]") + . "^ *\\(\t+\\).") "Regexps to match indentation whitespace that should be visualized. The value should be a cons whose car specifies the regexp to match @@ -1752,7 +1752,7 @@ whitespace-report-region ((eq (car option) 'space-after-tab::space) (whitespace-space-after-tab-regexp 'space)) ((eq (car option) 'missing-newline-at-eof) - "[^\n]\\'") + ".\\'") (t (cdr option))))) (when (re-search-forward regexp rend t) @@ -2188,14 +2188,14 @@ whitespace-color-on 1 whitespace-space-after-tab t))) ,@(when (memq 'missing-newline-at-eof whitespace-active-style) ;; Show missing newline. - `(("[^\n]\\'" 0 - ;; Don't mark the end of the buffer is point is there -- + `((".\\'" 0 + ;; Don't mark the end of the buffer if point is there -- ;; it probably means that the user is typing something ;; at the end of the buffer. (and (/= whitespace-point (point-max)) 'whitespace-missing-newline-at-eof) - t))))) - (font-lock-add-keywords nil whitespace-font-lock-keywords t) + prepend))))) + (font-lock-add-keywords nil whitespace-font-lock-keywords 'append) (font-lock-flush))) --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#73332
; Package emacs
.
Full text available.Received: (at 73332) by debbugs.gnu.org; 19 Sep 2024 09:47:41 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 05:47:41 2024 Received: from localhost ([127.0.0.1]:59824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1srDlF-0003bN-3H for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 05:47:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1srDlD-0003b9-Bu for 73332 <at> debbugs.gnu.org; Thu, 19 Sep 2024 05:47:39 -0400 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 1srDkp-0008Tj-4B; Thu, 19 Sep 2024 05:47:15 -0400 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=MG4CspGu7L6Bp+dvHCBiCjtdvwYlJ3bXH6d9d6lv6ww=; b=GWMkgl8TV9wF HO0Gh/UJnz6zQfZsbxUWjbXUvDY84ijaoWvnkAkxc43ouRpnv9XX0cWdOZs3N40nKSWcStbgq+cun ojtJQ44H8lIF8CKeVAZwL7aUJboxeSXPdDfed7vA1DhvIM7bxu4Mc/2hP0KuWU6PusL9lSJeE3XpE jWqe7T4NS3zHO1+VF2Gxr0SsQWzsw0YVlB5aqOTsQyXfIPvuvC+CZNRb+9cl6Ll6je+uThAcVCh2Y lnCZTvmfoh4Vaee9lLN5hV57z7/kfptuPSPGJDWa3Yb78Sr3tkJetESuyRTXuPDrTQdQGmNq6+61b /ew8HK+s4py2rgWe8EjnHw==; Date: Thu, 19 Sep 2024 12:46:33 +0300 Message-Id: <86y13o7z7q.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Jordan Ellis Coppard <jc+o.emacs@HIDDEN>, Richard Hansen <rhansen@HIDDEN>, Stefan Monnier <monnier@HIDDEN> In-Reply-To: <9e04c81c-d95f-434f-aae7-6b65664bc479@HIDDEN> (bug-gnu-emacs@HIDDEN) Subject: Re: bug#73332: 31.0.50; Whitespace-mode breaking font-locking References: <9e04c81c-d95f-434f-aae7-6b65664bc479@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73332 Cc: 73332 <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 (---) > Date: Wed, 18 Sep 2024 21:44:53 +0900 > From: Jordan Ellis Coppard via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> > > Starting from `emacs -Q`: > > With whitespace-mode enabled (no other configuration at all) in an Elisp > buffer (or any other I've tested such as Org) the last character at the > end of the buffer has all fontification removed (confirmed with > describe-char) while typing and said character stays un-fontified until > the buffer is re-formatted (say by killing it and re-opening, or by > having whitespace cleanup occur). > > Whitespace-mode should not be stripping all fontification of the last > character in a buffer while typing. > > Open Emacs, create an Elisp buffer, enable whitespace-mode, and type a > comment (easiest to visualise): `;; Foo bar baz`. Notice as you type > this comment the last character has no fontification until a subsequent > one is typed or the aforementioned buffer re-formatting occurs. Thank you for your report. Richard, could you please look into this? There are at least two problems here, AFAICT. First, whitespace-mode does not refontify the character at EOB when there's no newline at EOB and you move point to or from EOB. This can be fixed by the patch below; any comments to it? The other problem is with fontification of the last character in the buffer when point is at EOB: the foreground color is removed from the last character, but the font-lock face for it is not restored. If I go to that character and invoke describe-text-properties, I see that it has the 'face' property of nil, and I think that's the reason. The nil value comes from this part of whitespace-font-lock-keywords: ,@(when (memq 'missing-newline-at-eof whitespace-active-style) ;; Show missing newline. `(("[^\n]\\'" 0 ;; Don't mark the end of the buffer is point is there -- ;; it probably means that the user is typing something ;; at the end of the buffer. (and (/= whitespace-point (point-max)) 'whitespace-missing-newline-at-eof) t))) That 'and' expression yields nil when point is at EOB. Stefan, is there a way of avoiding this effect, perhaps by using a function in whitespace-font-lock-keywords? This missing-newline-at-eof feature is new in Emacs 30, so I'd like to fix it on the emacs-30 release branch. Here's the patch that fixes the refontification of the last character when there's no newline at EOB: diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 28d131b..d1b1f84 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -2333,10 +2333,22 @@ whitespace-post-command-hook (font-lock-flush whitespace-eob-marker (1+ (buffer-size))))) (setq-local whitespace-buffer-changed nil) (setq whitespace-point (point)) ; current point position - (let ((refontify (and (eolp) ; It is at end of line ... - ;; ... with trailing SPACE or TAB - (or (memq (preceding-char) '(?\s ?\t))) - (line-beginning-position))) + (let ((refontify (or (and (eolp) ; It is at end of line ... + ;; ... with trailing SPACE or TAB + (or (memq (preceding-char) '(?\s ?\t))) + (line-beginning-position)) + (and (memq 'missing-newline-at-eof + ;; If user requested to highlight + ;; EOB without a newline... + whitespace-active-style) + ;; ...and the buffer is not empty... + (not (= (point-min) (point-max))) + (= (point-max) (without-restriction (point-max))) + ;; ...and no newline at EOB... + (not (eq (char-before (point-max)) ?\n)) + ;; ...then refontify the last character in + ;; the buffer + (max (1- (point-max)) (point-min))))) (ostart (overlay-start whitespace-point--used))) (cond ((not refontify)
bug-gnu-emacs@HIDDEN
:bug#73332
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 18 Sep 2024 13:39:14 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 18 09:39:14 2024 Received: from localhost ([127.0.0.1]:57345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1squtk-0004jE-MU for submit <at> debbugs.gnu.org; Wed, 18 Sep 2024 09:39:14 -0400 Received: from lists.gnu.org ([209.51.188.17]:39862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <jc+o.emacs@HIDDEN>) id 1squ3u-0001iO-22 for submit <at> debbugs.gnu.org; Wed, 18 Sep 2024 08:45:39 -0400 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 <jc+o.emacs@HIDDEN>) id 1squ3Y-0006Yq-Og for bug-gnu-emacs@HIDDEN; Wed, 18 Sep 2024 08:45:21 -0400 Received: from out-178.mta0.migadu.com ([91.218.175.178]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <jc+o.emacs@HIDDEN>) id 1squ3V-0001nx-DC for bug-gnu-emacs@HIDDEN; Wed, 18 Sep 2024 08:45:16 -0400 Message-ID: <9e04c81c-d95f-434f-aae7-6b65664bc479@HIDDEN> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wz.ht; s=key1; t=1726663504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O6aeCBGqps/UjMabR+Ocvc7Q1AYXatfdtOBysOu+sOU=; b=pNM2wzVLsLa5cCtizcy051xf7jTJozkbs4PEjDPF0kuEVNDy6VrOh38vnayxxf00GjBLlw DCgVFgBx9JLgYVsPESFcqyYofV3hhGZlUrPsTAY3pse43P4HRfHCuJm7VckTO2Rul2RXWy HpUVZNqF3w/WXAEZ4+Yqg/b2zN+gLL4= Date: Wed, 18 Sep 2024 21:44:53 +0900 MIME-Version: 1.0 Content-Language: en-US To: bug-gnu-emacs@HIDDEN X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and include these headers. From: Jordan Ellis Coppard <jc+o.emacs@HIDDEN> Subject: 31.0.50; Whitespace-mode breaking font-locking Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=91.218.175.178; envelope-from=jc+o.emacs@HIDDEN; helo=out-178.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 18 Sep 2024 09:39:05 -0400 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.4 (--) Hello, Starting from `emacs -Q`: With whitespace-mode enabled (no other configuration at all) in an Elisp buffer (or any other I've tested such as Org) the last character at the end of the buffer has all fontification removed (confirmed with describe-char) while typing and said character stays un-fontified until the buffer is re-formatted (say by killing it and re-opening, or by having whitespace cleanup occur). Whitespace-mode should not be stripping all fontification of the last character in a buffer while typing. Open Emacs, create an Elisp buffer, enable whitespace-mode, and type a comment (easiest to visualise): `;; Foo bar baz`. Notice as you type this comment the last character has no fontification until a subsequent one is typed or the aforementioned buffer re-formatting occurs. In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin23.5.0, NS appkit-2487.60 Version 14.5 (Build 23F79)) of 2024-09-16 built on yote.local Windowing system distributor 'Apple', version 10.3.2487 System Description: macOS 14.5 Configured using: 'configure --prefix=/opt/local --disable-silent-rules --without-dbus --without-gconf --without-libotf --without-m17n-flt --with-libgmp --with-gnutls --with-xml2 --with-modules --with-sqlite3 --with-webp --infodir /opt/local/share/info/emacs --with-native-compilation=no --with-ns --with-lcms2 --without-harfbuzz --without-imagemagick --without-xaw3d --with-rsvg --with-xwidgets --with-native-compilation=aot --with-tree-sitter 'CFLAGS=-pipe -Os -Wno-attributes -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64' 'CPPFLAGS=-I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk' 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-no_pie -Wl,-rpath /opt/local/lib/gcc14 -Wl,-rpath /opt/local/lib -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64'' Configured features: ACL GIF GLIB GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS ZLIB Important settings: value of $LC_ALL: en_US.UTF-8 value of $LC_CTYPE: en_US.UTF-8 value of $LANG: en_AU.UTF-8 locale-coding-system: utf-8-unix Major mode: Help Minor modes in effect: tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t isearch-fold-quotes-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t buffer-read-only: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr cl-extra pp wid-edit descr-text help-mode emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x cl-loaddefs cl-lib disp-table whitespace rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads xwidget-internal kqueue cocoa ns lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 63491 38364) (symbols 48 22693 0) (strings 32 84115 2344) (string-bytes 1 1921637) (vectors 16 10958) (vector-slots 8 222175 45778) (floats 8 139 3) (intervals 56 774 32) (buffers 992 14))
Jordan Ellis Coppard <jc+o.emacs@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#73332
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.