From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords Date: Tue, 09 Jan 2024 21:25:15 -0800 Message-ID: <87le8xg3pg.fsf@ericabrahamsen.net> References: <8734v62rc2.fsf@ice9.digital> <87plyafahh.fsf@ericabrahamsen.net> <87r0iq1735.fsf@ice9.digital> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30805"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 68352@debbugs.gnu.org To: Morgan Willcock Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 10 06:26:16 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 1rNR6V-0007q4-SM for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jan 2024 06:26:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNR6D-0002fe-M0; Wed, 10 Jan 2024 00:25: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 1rNR6B-0002fA-4H for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 00:25:55 -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 1rNR6A-00069o-Sl for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 00:25:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNR6H-0005tU-MW for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 00:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jan 2024 05:26:01 +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.170486433922616 (code B ref 68352); Wed, 10 Jan 2024 05:26:01 +0000 Original-Received: (at 68352) by debbugs.gnu.org; 10 Jan 2024 05:25:39 +0000 Original-Received: from localhost ([127.0.0.1]:41574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNR5v-0005sf-7o for submit@debbugs.gnu.org; Wed, 10 Jan 2024 00:25:39 -0500 Original-Received: from mail.ericabrahamsen.net ([52.70.2.18]:52504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNR5t-0005sN-8E for 68352@debbugs.gnu.org; Wed, 10 Jan 2024 00:25:38 -0500 Original-Received: from localhost (71-212-21-65.tukw.qwest.net [71.212.21.65]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 82852FA02E; Wed, 10 Jan 2024 05:25:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1704864321; bh=5HvCLVPZDYMVmsp1mbCyON9KKzo9yx2lxEsCpKtAq1I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=bpGyCbdVqEEAZdknj1K6XbSSigy50QCvXN93DYCo62jWi4a/dpQZbIQaExvr5YIRt ghK0csxPVzAxYqZi0d01hklDLD2HH0L0OudJnMtpyg76N8cQMY3fP96/IIOX6HFbOn yGCkZmZSrs17pmJCUfp9nnXbDRODzUzumcxwCEWE= In-Reply-To: <87r0iq1735.fsf@ice9.digital> (Morgan Willcock's message of "Tue, 09 Jan 2024 22:21:18 +0000") 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:277679 Archived-At: Morgan Willcock writes: > 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! Ha, my eyes went right by that comment. > 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'. So maybe this is enough? (define-minor-mode gnus-message-citation-mode "Minor mode providing more font-lock support for nested citations. When enabled, it automatically turns on `font-lock-mode'." :lighter "" (when (derived-mode-p 'message-mode) (if gnus-message-citation-mode (font-lock-add-keywords nil gnus-message-citation-keywords) (font-lock-remove-keywords nil gnus-message-citation-keywords)) (if font-lock-mode (font-lock-flush) (gnus-message-citation-mode (font-lock-mode 1)))))