From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Morgan Willcock Newsgroups: gmane.emacs.bugs Subject: bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords Date: Tue, 09 Jan 2024 22:21:18 +0000 Message-ID: <87r0iq1735.fsf@ice9.digital> References: <8734v62rc2.fsf@ice9.digital> <87plyafahh.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32340"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 68352@debbugs.gnu.org To: Eric Abrahamsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 09 23:22:10 2024 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 1rNKU3-00086T-0p for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Jan 2024 23:22:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNKTt-0005bB-4b; Tue, 09 Jan 2024 17:21:57 -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 1rNKTr-0005ZT-T2 for bug-gnu-emacs@gnu.org; Tue, 09 Jan 2024 17:21:56 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNKTr-0001Gw-L1 for bug-gnu-emacs@gnu.org; Tue, 09 Jan 2024 17:21:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNKTy-0005eZ-9W for bug-gnu-emacs@gnu.org; Tue, 09 Jan 2024 17:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Morgan Willcock Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Jan 2024 22:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68352 X-GNU-PR-Package: emacs Original-Received: via spool by 68352-submit@debbugs.gnu.org id=B68352.170483889621689 (code B ref 68352); Tue, 09 Jan 2024 22:22:02 +0000 Original-Received: (at 68352) by debbugs.gnu.org; 9 Jan 2024 22:21:36 +0000 Original-Received: from localhost ([127.0.0.1]:41190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNKTY-0005dk-5T for submit@debbugs.gnu.org; Tue, 09 Jan 2024 17:21:36 -0500 Original-Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]:40005) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNKTW-0005dW-AG for 68352@debbugs.gnu.org; Tue, 09 Jan 2024 17:21:35 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 1D9331C0003; Tue, 9 Jan 2024 22:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ice9.digital; s=gm1; t=1704838880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dvjW1m4zOHl/+SHZvw4jV07HN5iGanRRstmlrD/1U/k=; b=g7g3zhdcNiR+GDsDJajzeOQ5hdBc+T2zrTu+i7j9PtjuJwxvwG5WIAiDhRX2BNcelY0thc 4s3FQ9iJ7OWV61FllxDsw+E/skHzCfnAenY7Et9jQFE3khC2Ot3mpckZ7ZyFzlNT71xdk7 VwAyi1M7HGDNN/Hb6jUsmwTxntM7vJEiaQhRQNC5jZNhQ0W43seLM7mj/tbqDNp9q1fR/j NvC5R5zXpMFNKzHTsSB6AvE+LcdBC2bFDkpKzZkEvJY9kSnVOKXIyuPyYXVJQeatkwPVFW qXkcRkLQuZrRgosuZXk7BempF1g/Mg6Axrn7KUPrMVyw//9f07NXZRYtFoZOow== In-Reply-To: <87plyafahh.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Tue, 09 Jan 2024 13:44:10 -0800") X-GND-Sasl: morgan@ice9.digital 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:277666 Archived-At: Eric Abrahamsen writes: > Morgan Willcock writes: > >> When Gnus enables gnus-message-citation-mode in message buffers, as it >> does by default, it calls the function `font-lock-set-defaults' and >> loses any additional font-lock rules which may have been added by global >> minor-modes. > > Thanks for the report. I don't know font locking well enough to know > what the right solution is here. It looks calling `font-lock-flush' will > also end up calling `font-lock-set-defaults' as well, at least with > default values: > > font-lock-flush-function -> > font-lock-after-change-function -> > font-lock-fontify-region -> > font-lock-set-defaults > > Is the problem setting `font-lock-set-defaults' to nil? Is there > anything else you can recommend? I think that I did test not setting `font-lock-set-defaults' to nil to see if that made a difference, but the same problem was still there. I don't know very much myself, but in that section of code there is a comment left by Stefan Monnier: ;; FIXME: Use font-lock-add-keywords! So I would guess that the correct solution would be to add the citation font-locking rules with `font-lock-add-keywords' and then remove them again with `font-lock-remove-keywords' if the mode is ever disabled, and if the highlighting needs an update after those changes, call `font-lock-flush'. (When testing I'm not seeing that a call to `font-lock-flush' will lose any values from `font-lock-keywords'.) -- Morgan Willcock