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: Wed, 10 Jan 2024 10:51:49 -0800 Message-ID: <875y01dnsq.fsf@ericabrahamsen.net> References: <8734v62rc2.fsf@ice9.digital> <87plyafahh.fsf@ericabrahamsen.net> <87r0iq1735.fsf@ice9.digital> <87le8xg3pg.fsf@ericabrahamsen.net> <87wmshdxj1.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="3920"; 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 19:52:25 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 1rNdgf-0000kn-Hg for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jan 2024 19:52:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNdgL-00069V-QG; Wed, 10 Jan 2024 13:52:05 -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 1rNdgJ-000693-EF for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 13:52:03 -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 1rNdgJ-0005p8-5t for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 13:52:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNdgH-0006px-Rv for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 13:52: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 18:52: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.170491271826272 (code B ref 68352); Wed, 10 Jan 2024 18:52:01 +0000 Original-Received: (at 68352) by debbugs.gnu.org; 10 Jan 2024 18:51:58 +0000 Original-Received: from localhost ([127.0.0.1]:43198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNdgE-0006pf-2S for submit@debbugs.gnu.org; Wed, 10 Jan 2024 13:51:58 -0500 Original-Received: from mail.ericabrahamsen.net ([52.70.2.18]:45056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNdgC-0006pU-EV for 68352@debbugs.gnu.org; Wed, 10 Jan 2024 13:51:57 -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 DF177FA0D9; Wed, 10 Jan 2024 18:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1704912711; bh=/WJ0XzHxB7S1cZ11fst24z4sJqNRSNM+W0fZtLgM6Ic=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=mBMjdKc+5OSyTOOH2TiBaJqs6fqxPRZVHoT1uRx9MIu/tyt2NX0zaAeEXWJjUw2Mj VU25Swk7yDRggEcxmbHXB3Rrubx+pV6hKjACZPcj7oIcbHMeZm3Yl/MhONCoafhhUB xuTXVE1aRZjdA1b8Z5lrOdkGMWgwIMDJKDrzS4/4= In-Reply-To: <87wmshdxj1.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Wed, 10 Jan 2024 07:21:38 -0800") 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:277812 Archived-At: Eric Abrahamsen writes: > Eric Abrahamsen writes: > >> 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))))) > > No, that doesn't do it. The thing is, even if you defuse this minor mode > entirely (I replaced the body with `(message "Whee!")'), > global-whitespace-mode has already been overridden by the time we come > to run this minor-mode function. It's already getting clobbered at some > earlier point. Actually, it might just be that something about message-mode suppresses whitespace-mode altogether. Even if I turn it on *after* starting a reply, no font-locking of whitespace is done.