unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
@ 2024-01-09 20:18 Morgan Willcock
  2024-01-09 21:44 ` Eric Abrahamsen
  0 siblings, 1 reply; 11+ messages in thread
From: Morgan Willcock @ 2024-01-09 20:18 UTC (permalink / raw)
  To: 68352



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.

The best example to demonstrate the problem is by enabling
global-whitespace-mode.  The font-lock rules for whitespace are lost
when gnus-message-citation-mode is enabled, which means that
global-whitespace-mode will work correctly in plain message buffers, but
will appear to be broken in message buffers opened by Gnus.

Example for use with emacs -Q:

  (require 'gnus-cite)
  (require 'whitespace)

  (add-function :before-until whitespace-enable-predicate
                (lambda () (eq major-mode 'message-mode)))
  (global-whitespace-mode)
  (compose-mail)
  ;; Whitespace font-lock rules are present in `font-lock-keywords' at
  ;; this point.
  (gnus-message-citation-mode)
  ;; `font-lock-keywords' has now been reset, and the font-lock rules
  ;; for citations are added, but the whitespace font-lock rules have
  ;; been lost.



In GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2023-07-31 built on inspiron
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-native-compilation --with-cairo --with-json
 --with-xml2 --with-x-toolkit=lucid'

Configured features:
CAIRO FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XAW3D
XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Org-Agenda Week Ddl Grid

Minor modes in effect:
  server-mode: t
  global-corfu-mode: t
  corfu-mode: t
  jabber-activity-mode: t
  which-key-mode: t
  global-devil-mode: t
  devil-mode: t
  global-whitespace-mode: t
  erc-spelling-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  minibuffer-depth-indicate-mode: t
  ido-everywhere: t
  recentf-mode: t
  shell-dirtrack-mode: t
  global-hl-line-mode: t
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/mwillcock/.emacs.d/custom/powershell.el/powershell hides /home/mwillcock/.emacs.d/custom/powershell
/home/mwillcock/.emacs.d/elpa/flymake-1.3.7/flymake hides /usr/local/share/emacs/29.1/lisp/progmodes/flymake
/home/mwillcock/.emacs.d/elpa/project-0.10.0/project hides /usr/local/share/emacs/29.1/lisp/progmodes/project
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-man hides /usr/local/share/emacs/29.1/lisp/org/ol-man
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-colview hides /usr/local/share/emacs/29.1/lisp/org/org-colview
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-texinfo hides /usr/local/share/emacs/29.1/lisp/org/ox-texinfo
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-doi hides /usr/local/share/emacs/29.1/lisp/org/ol-doi
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-docview hides /usr/local/share/emacs/29.1/lisp/org/ol-docview
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-ascii hides /usr/local/share/emacs/29.1/lisp/org/ox-ascii
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-refile hides /usr/local/share/emacs/29.1/lisp/org/org-refile
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-ctags hides /usr/local/share/emacs/29.1/lisp/org/org-ctags
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-latex hides /usr/local/share/emacs/29.1/lisp/org/ob-latex
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-clojure hides /usr/local/share/emacs/29.1/lisp/org/ob-clojure
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-inlinetask hides /usr/local/share/emacs/29.1/lisp/org/org-inlinetask
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-js hides /usr/local/share/emacs/29.1/lisp/org/ob-js
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-groovy hides /usr/local/share/emacs/29.1/lisp/org/ob-groovy
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-lua hides /usr/local/share/emacs/29.1/lisp/org/ob-lua
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-lilypond hides /usr/local/share/emacs/29.1/lisp/org/ob-lilypond
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-table hides /usr/local/share/emacs/29.1/lisp/org/ob-table
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-id hides /usr/local/share/emacs/29.1/lisp/org/org-id
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-compat hides /usr/local/share/emacs/29.1/lisp/org/org-compat
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-exp hides /usr/local/share/emacs/29.1/lisp/org/ob-exp
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-version hides /usr/local/share/emacs/29.1/lisp/org/org-version
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-R hides /usr/local/share/emacs/29.1/lisp/org/ob-R
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-indent hides /usr/local/share/emacs/29.1/lisp/org/org-indent
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-julia hides /usr/local/share/emacs/29.1/lisp/org/ob-julia
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-sed hides /usr/local/share/emacs/29.1/lisp/org/ob-sed
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-keys hides /usr/local/share/emacs/29.1/lisp/org/org-keys
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-ditaa hides /usr/local/share/emacs/29.1/lisp/org/ob-ditaa
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-lint hides /usr/local/share/emacs/29.1/lisp/org/org-lint
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-ruby hides /usr/local/share/emacs/29.1/lisp/org/ob-ruby
/home/mwillcock/.emacs.d/elpa/org-9.6.16/oc-bibtex hides /usr/local/share/emacs/29.1/lisp/org/oc-bibtex
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-core hides /usr/local/share/emacs/29.1/lisp/org/ob-core
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-comint hides /usr/local/share/emacs/29.1/lisp/org/ob-comint
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol hides /usr/local/share/emacs/29.1/lisp/org/ol
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-capture hides /usr/local/share/emacs/29.1/lisp/org/org-capture
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-agenda hides /usr/local/share/emacs/29.1/lisp/org/org-agenda
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-gnus hides /usr/local/share/emacs/29.1/lisp/org/ol-gnus
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-koma-letter hides /usr/local/share/emacs/29.1/lisp/org/ox-koma-letter
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-haskell hides /usr/local/share/emacs/29.1/lisp/org/ob-haskell
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-faces hides /usr/local/share/emacs/29.1/lisp/org/org-faces
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org hides /usr/local/share/emacs/29.1/lisp/org/org
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-dot hides /usr/local/share/emacs/29.1/lisp/org/ob-dot
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-lisp hides /usr/local/share/emacs/29.1/lisp/org/ob-lisp
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-awk hides /usr/local/share/emacs/29.1/lisp/org/ob-awk
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-element hides /usr/local/share/emacs/29.1/lisp/org/org-element
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-goto hides /usr/local/share/emacs/29.1/lisp/org/org-goto
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-org hides /usr/local/share/emacs/29.1/lisp/org/ox-org
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-makefile hides /usr/local/share/emacs/29.1/lisp/org/ob-makefile
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-publish hides /usr/local/share/emacs/29.1/lisp/org/ox-publish
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-maxima hides /usr/local/share/emacs/29.1/lisp/org/ob-maxima
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-loaddefs hides /usr/local/share/emacs/29.1/lisp/org/org-loaddefs
/home/mwillcock/.emacs.d/elpa/org-9.6.16/oc hides /usr/local/share/emacs/29.1/lisp/org/oc
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-python hides /usr/local/share/emacs/29.1/lisp/org/ob-python
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-screen hides /usr/local/share/emacs/29.1/lisp/org/ob-screen
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-C hides /usr/local/share/emacs/29.1/lisp/org/ob-C
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-mouse hides /usr/local/share/emacs/29.1/lisp/org/org-mouse
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-attach-git hides /usr/local/share/emacs/29.1/lisp/org/org-attach-git
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-shell hides /usr/local/share/emacs/29.1/lisp/org/ob-shell
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-gnuplot hides /usr/local/share/emacs/29.1/lisp/org/ob-gnuplot
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-beamer hides /usr/local/share/emacs/29.1/lisp/org/ox-beamer
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-pcomplete hides /usr/local/share/emacs/29.1/lisp/org/org-pcomplete
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-tempo hides /usr/local/share/emacs/29.1/lisp/org/org-tempo
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-odt hides /usr/local/share/emacs/29.1/lisp/org/ox-odt
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-lob hides /usr/local/share/emacs/29.1/lisp/org/ob-lob
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-sass hides /usr/local/share/emacs/29.1/lisp/org/ob-sass
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-fold-core hides /usr/local/share/emacs/29.1/lisp/org/org-fold-core
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-table hides /usr/local/share/emacs/29.1/lisp/org/org-table
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-irc hides /usr/local/share/emacs/29.1/lisp/org/ol-irc
/home/mwillcock/.emacs.d/elpa/org-9.6.16/oc-basic hides /usr/local/share/emacs/29.1/lisp/org/oc-basic
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-md hides /usr/local/share/emacs/29.1/lisp/org/ox-md
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-emacs-lisp hides /usr/local/share/emacs/29.1/lisp/org/ob-emacs-lisp
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-macs hides /usr/local/share/emacs/29.1/lisp/org/org-macs
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-w3m hides /usr/local/share/emacs/29.1/lisp/org/ol-w3m
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-datetree hides /usr/local/share/emacs/29.1/lisp/org/org-datetree
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-persist hides /usr/local/share/emacs/29.1/lisp/org/org-persist
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-matlab hides /usr/local/share/emacs/29.1/lisp/org/ob-matlab
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-mhe hides /usr/local/share/emacs/29.1/lisp/org/ol-mhe
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-cycle hides /usr/local/share/emacs/29.1/lisp/org/org-cycle
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-man hides /usr/local/share/emacs/29.1/lisp/org/ox-man
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-ref hides /usr/local/share/emacs/29.1/lisp/org/ob-ref
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-archive hides /usr/local/share/emacs/29.1/lisp/org/org-archive
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob hides /usr/local/share/emacs/29.1/lisp/org/ob
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-scheme hides /usr/local/share/emacs/29.1/lisp/org/ob-scheme
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-org hides /usr/local/share/emacs/29.1/lisp/org/ob-org
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-eshell hides /usr/local/share/emacs/29.1/lisp/org/ob-eshell
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-crypt hides /usr/local/share/emacs/29.1/lisp/org/org-crypt
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-rmail hides /usr/local/share/emacs/29.1/lisp/org/ol-rmail
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-plot hides /usr/local/share/emacs/29.1/lisp/org/org-plot
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-clock hides /usr/local/share/emacs/29.1/lisp/org/org-clock
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-macro hides /usr/local/share/emacs/29.1/lisp/org/org-macro
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-icalendar hides /usr/local/share/emacs/29.1/lisp/org/ox-icalendar
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-fortran hides /usr/local/share/emacs/29.1/lisp/org/ob-fortran
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-plantuml hides /usr/local/share/emacs/29.1/lisp/org/ob-plantuml
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-bibtex hides /usr/local/share/emacs/29.1/lisp/org/ol-bibtex
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-protocol hides /usr/local/share/emacs/29.1/lisp/org/org-protocol
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-octave hides /usr/local/share/emacs/29.1/lisp/org/ob-octave
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-timer hides /usr/local/share/emacs/29.1/lisp/org/org-timer
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-forth hides /usr/local/share/emacs/29.1/lisp/org/ob-forth
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-feed hides /usr/local/share/emacs/29.1/lisp/org/org-feed
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-list hides /usr/local/share/emacs/29.1/lisp/org/org-list
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-info hides /usr/local/share/emacs/29.1/lisp/org/ol-info
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-perl hides /usr/local/share/emacs/29.1/lisp/org/ob-perl
/home/mwillcock/.emacs.d/elpa/org-9.6.16/oc-csl hides /usr/local/share/emacs/29.1/lisp/org/oc-csl
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-processing hides /usr/local/share/emacs/29.1/lisp/org/ob-processing
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-eshell hides /usr/local/share/emacs/29.1/lisp/org/ol-eshell
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-eval hides /usr/local/share/emacs/29.1/lisp/org/ob-eval
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox hides /usr/local/share/emacs/29.1/lisp/org/ox
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-habit hides /usr/local/share/emacs/29.1/lisp/org/org-habit
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-calc hides /usr/local/share/emacs/29.1/lisp/org/ob-calc
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-footnote hides /usr/local/share/emacs/29.1/lisp/org/org-footnote
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-attach hides /usr/local/share/emacs/29.1/lisp/org/org-attach
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-latex hides /usr/local/share/emacs/29.1/lisp/org/ox-latex
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-ocaml hides /usr/local/share/emacs/29.1/lisp/org/ob-ocaml
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-eww hides /usr/local/share/emacs/29.1/lisp/org/ol-eww
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-css hides /usr/local/share/emacs/29.1/lisp/org/ob-css
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ox-html hides /usr/local/share/emacs/29.1/lisp/org/ox-html
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-mobile hides /usr/local/share/emacs/29.1/lisp/org/org-mobile
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-sqlite hides /usr/local/share/emacs/29.1/lisp/org/ob-sqlite
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-tangle hides /usr/local/share/emacs/29.1/lisp/org/ob-tangle
/home/mwillcock/.emacs.d/elpa/org-9.6.16/oc-biblatex hides /usr/local/share/emacs/29.1/lisp/org/oc-biblatex
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-java hides /usr/local/share/emacs/29.1/lisp/org/ob-java
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-entities hides /usr/local/share/emacs/29.1/lisp/org/org-entities
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-num hides /usr/local/share/emacs/29.1/lisp/org/org-num
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-duration hides /usr/local/share/emacs/29.1/lisp/org/org-duration
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ol-bbdb hides /usr/local/share/emacs/29.1/lisp/org/ol-bbdb
/home/mwillcock/.emacs.d/elpa/org-9.6.16/ob-sql hides /usr/local/share/emacs/29.1/lisp/org/ob-sql
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-src hides /usr/local/share/emacs/29.1/lisp/org/org-src
/home/mwillcock/.emacs.d/elpa/org-9.6.16/org-fold hides /usr/local/share/emacs/29.1/lisp/org/org-fold
/home/mwillcock/.emacs.d/elpa/org-9.6.16/oc-natbib hides /usr/local/share/emacs/29.1/lisp/org/oc-natbib
/home/mwillcock/.emacs.d/elpa/eldoc-1.15.0/eldoc hides /usr/local/share/emacs/29.1/lisp/emacs-lisp/eldoc

Features:
(shadow sort ecomplete mail-extr emacsbug gnus-topic nndraft nnmh utf-7
cursor-sensor epa-file network-stream nsm nnfolder nnnil gnus-agent
gnus-srvr gnus-score score-mode nnvirtual nntp gnus-cache server cal-iso
autorevert face-remap display-fill-column-indicator init corfu
powershell php-mode mode-local speedbar ezimage dframe php-face php
php-project jabber jabber-ourversion hippie-exp hexrgb fsm sgml-mode
facemenu sasl sasl-anonymous sasl-login sasl-plain srv dns starttls tls
goto-addr yaml-mode markdown-mode lua-mode advice edmacro kmacro
kixtart-mode tempo org-msg let-alist color ox-odt rng-loc rng-uri
rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table ox-ascii
ox-publish ox htmlize gnus-msg gnus-icalendar icalendar gnus-dired
gnus-cite which-key devil delight comp comp-cstr ags-mode whitespace
eglot external-completion array jsonrpc ert ewoc debug backtrace xref
flymake warnings imenu python project treesit cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
erc-spelling flyspell erc-track erc-match erc-join erc-goodies erc
erc-backend erc-networks erc-common erc-compat compat erc-loaddefs ediff
ediff-merg ediff-mult ediff-wind ediff-diff ediff-help ediff-init
ediff-util vc-git diff-mode easy-mmode vc-dispatcher org-indent oc-basic
cl-extra ol-eww eww url-queue thingatpt mm-url ol-rmail ol-mhe ol-irc
ol-info ol-gnus nnselect gnus-art mm-uu mml2015 gnus-sum ol-docview
doc-view filenotify jka-compr image-mode exif ol-bibtex bibtex ol-bbdb
ol-w3m ol-doi org-link-doi appt diary-lib diary-loaddefs org-capture
ob-shell ob-plantuml ob-dot org-goto org-clock org-duration org-agenda
org-element org-persist xdg org-id avl-tree generator org-refile org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint
org-pcomplete org-list org-footnote org-faces org-entities noutline
outline ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs org-version org-compat org-macs
autoinsert compile bookmark savehist crm minibuf-eldef mb-depth ido
tramp-cache time-stamp tramp-sh tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat rx format-spec cus-edit pp
cus-load icons recentf tree-widget shell pcomplete comint ansi-osc
ansi-color ring hl-line time gnus-group gnus-undo gnus-start gnus-dbus
dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time iso8601
gnus-spec gnus-int gnus-range gnus-win gnus nnheader range wid-edit
dictionary dictionary-connection ispell shr pixel-fill kinsoku url-file
svg xml dom modus-vivendi-theme modus-themes mm-view mml-smime smime
gnutls dig smtpmail message sendmail yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 gnus-util
text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev
mail-utils gmm-utils mailheader epg-config help-mode find-func cal-menu
calendar cal-loaddefs pcase corfu-autoloads compat-autoloads
delight-autoloads do-at-point-autoloads flymake-autoloads
eldoc-autoloads fsm-autoloads htmlize-autoloads lua-mode-autoloads
markdown-mode-autoloads modus-themes-autoloads info org-autoloads
php-mode-autoloads project-autoloads rainbow-mode-autoloads
renpy-mode-autoloads which-key-autoloads yaml-mode-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache
json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs
cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd 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 inotify dynamic-setting system-font-setting font-render-setting
cairo x-toolkit x multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 1428121 74014)
 (symbols 48 46088 5)
 (strings 32 227105 18973)
 (string-bytes 1 6409197)
 (vectors 16 92579)
 (vector-slots 8 2267284 72324)
 (floats 8 717 235)
 (intervals 56 97870 0)
 (buffers 976 17))

-- 
Morgan Willcock





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
  2024-01-09 20:18 bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords Morgan Willcock
@ 2024-01-09 21:44 ` Eric Abrahamsen
  2024-01-09 22:21   ` Morgan Willcock
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Abrahamsen @ 2024-01-09 21:44 UTC (permalink / raw)
  To: Morgan Willcock; +Cc: 68352

Morgan Willcock <morgan@ice9.digital> 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?

Thanks,
Eric





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
  2024-01-09 21:44 ` Eric Abrahamsen
@ 2024-01-09 22:21   ` Morgan Willcock
  2024-01-10  5:25     ` Eric Abrahamsen
  0 siblings, 1 reply; 11+ messages in thread
From: Morgan Willcock @ 2024-01-09 22:21 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 68352

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Morgan Willcock <morgan@ice9.digital> 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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
  2024-01-09 22:21   ` Morgan Willcock
@ 2024-01-10  5:25     ` Eric Abrahamsen
  2024-01-10 15:21       ` Eric Abrahamsen
  2024-01-10 22:16       ` Morgan Willcock
  0 siblings, 2 replies; 11+ messages in thread
From: Eric Abrahamsen @ 2024-01-10  5:25 UTC (permalink / raw)
  To: Morgan Willcock; +Cc: 68352

Morgan Willcock <morgan@ice9.digital> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Morgan Willcock <morgan@ice9.digital> 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)))))





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
  2024-01-10  5:25     ` Eric Abrahamsen
@ 2024-01-10 15:21       ` Eric Abrahamsen
  2024-01-10 18:51         ` Eric Abrahamsen
  2024-01-10 22:16       ` Morgan Willcock
  1 sibling, 1 reply; 11+ messages in thread
From: Eric Abrahamsen @ 2024-01-10 15:21 UTC (permalink / raw)
  To: Morgan Willcock; +Cc: 68352

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Morgan Willcock <morgan@ice9.digital> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> Morgan Willcock <morgan@ice9.digital> 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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
  2024-01-10 15:21       ` Eric Abrahamsen
@ 2024-01-10 18:51         ` Eric Abrahamsen
  2024-01-10 19:20           ` Morgan Willcock
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Abrahamsen @ 2024-01-10 18:51 UTC (permalink / raw)
  To: Morgan Willcock; +Cc: 68352

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Morgan Willcock <morgan@ice9.digital> writes:
>>
>>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>>
>>>> Morgan Willcock <morgan@ice9.digital> 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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
  2024-01-10 18:51         ` Eric Abrahamsen
@ 2024-01-10 19:20           ` Morgan Willcock
  0 siblings, 0 replies; 11+ messages in thread
From: Morgan Willcock @ 2024-01-10 19:20 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 68352

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> Morgan Willcock <morgan@ice9.digital> writes:
>>>
>>>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>>>
>>>>> Morgan Willcock <morgan@ice9.digital> 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.

I haven't had a chance to re-test anything yet (I'm fairly sure that
removing the call to `font-lock-set-defaults' kept the whitespace
font-lock rules in-place), but if you are seeing issues with
whitespace-mode being turned on then it is probably because the value of
`whitespace-enable-predicate' has not been modified.

Because of the default predicate value, whitespace-mode does not apply
to any buffer where the name begins with an asterisk (with the exception
of the scratch buffer), and the message buffer is usually named
something like "*unsent mail*".  That is why the example to recreate the
problem needed a change to the predicate value:

  (add-function :before-until whitespace-enable-predicate
                (lambda () (eq major-mode 'message-mode)))

This might look a bit like I've hacked my way into creating the problem
that I'm reporting, but this is actually what the docstring for the
value instructs you to do to change the behaviour, and I don't think any
of the default restrictions are there to avoid font-lock problems.

-- 
Morgan Willcock





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
  2024-01-10  5:25     ` Eric Abrahamsen
  2024-01-10 15:21       ` Eric Abrahamsen
@ 2024-01-10 22:16       ` Morgan Willcock
  2024-01-11 11:57         ` Morgan Willcock
  1 sibling, 1 reply; 11+ messages in thread
From: Morgan Willcock @ 2024-01-10 22:16 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 68352

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> 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)))))

I think this does fix it, although I've added the optional argument to
append to the end of the font-lock rules and restored the comment which
suggested why it previously worked that way.

  (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
          ;; `gnus-message-citation-keywords' should be the last
          ;; elements of the keywords because the others are unlikely to
          ;; have the OVERRIDE flags -- XEmacs applies a keyword having
          ;; no OVERRIDE flag to matched text even if it has already
          ;; other faces, while Emacs doesn't.
          (font-lock-add-keywords nil gnus-message-citation-keywords t)
        (font-lock-remove-keywords nil gnus-message-citation-keywords))
      (if font-lock-mode
          (font-lock-flush)
        (gnus-message-citation-mode (font-lock-mode 1)))))

-- 
Morgan Willcock





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
  2024-01-10 22:16       ` Morgan Willcock
@ 2024-01-11 11:57         ` Morgan Willcock
  2024-02-11  8:48           ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Morgan Willcock @ 2024-01-11 11:57 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 68352

[-- Attachment #1: Type: text/plain, Size: 289 bytes --]

I've attached a patch which is essentially the same as Eric's suggestion
except that, the original comment is kept, the HOW argument of
`font-lock-add-keywords' is set to t, and the code is restructured to
avoid any font-lock changes until `font-lock-mode' is active.

-- 
Morgan Willcock

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Avoid-font-lock-reset-in-gnus-message-citation-mode.patch --]
[-- Type: text/x-diff, Size: 2565 bytes --]

From 9fa84932aa0ad7c37b20d68ca358ee779d225f09 Mon Sep 17 00:00:00 2001
From: Morgan Willcock <morgan@ice9.digital>
Date: Wed, 10 Jan 2024 21:29:29 +0000
Subject: [PATCH] Avoid font-lock reset in `gnus-message-citation-mode'

* lisp/gnus/gnus-cite.el (gnus-message-citation-mode): Use
`font-lock-add-keywords' and `font-lock-remove-keywords' instead of
modifying font-lock defaults.  Make no font-lock changes until
`font-lock-mode' is active.
---
 lisp/gnus/gnus-cite.el | 36 +++++++++++-------------------------
 1 file changed, 11 insertions(+), 25 deletions(-)

diff --git a/lisp/gnus/gnus-cite.el b/lisp/gnus/gnus-cite.el
index 04abdfc0d1b..3fde9baa0fe 100644
--- a/lisp/gnus/gnus-cite.el
+++ b/lisp/gnus/gnus-cite.el
@@ -1122,31 +1122,17 @@ gnus-message-citation-mode
 When enabled, it automatically turns on `font-lock-mode'."
   :lighter ""
   (when (derived-mode-p 'message-mode)
-    ;; FIXME: Use font-lock-add-keywords!
-    (let ((defaults (car font-lock-defaults))
-	  default) ;; keywords
-      (while defaults
-	(setq default (if (consp defaults)
-			  (pop defaults)
-			(prog1
-			    defaults
-			  (setq defaults nil))))
-	(if gnus-message-citation-mode
-	    ;; `gnus-message-citation-keywords' should be the last
-	    ;; elements of the keywords because the others are unlikely
-	    ;; to have the OVERRIDE flags -- XEmacs applies a keyword
-	    ;; having no OVERRIDE flag to matched text even if it has
-	    ;; already other faces, while Emacs doesn't.
-	    (set (make-local-variable default)
-		 (append (default-value default)
-			 gnus-message-citation-keywords))
-	  (kill-local-variable default))))
-    ;; Force `font-lock-set-defaults' to update `font-lock-keywords'.
-    (setq font-lock-set-defaults nil)
-    (font-lock-set-defaults)
-    (if font-lock-mode
-	(font-lock-flush)
-      (gnus-message-citation-mode (font-lock-mode 1)))))
+    (if (not font-lock-mode)
+        (gnus-message-citation-mode (font-lock-mode 1))
+      (if gnus-message-citation-mode
+	  ;; `gnus-message-citation-keywords' should be the last
+	  ;; elements of the keywords because the others are unlikely
+	  ;; to have the OVERRIDE flags -- XEmacs applies a keyword
+	  ;; having no OVERRIDE flag to matched text even if it has
+	  ;; already other faces, while Emacs doesn't.
+	  (font-lock-add-keywords nil gnus-message-citation-keywords t)
+        (font-lock-remove-keywords nil gnus-message-citation-keywords))
+      (font-lock-flush))))
 
 (defun turn-on-gnus-message-citation-mode ()
   "Turn on `gnus-message-citation-mode'."
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
  2024-01-11 11:57         ` Morgan Willcock
@ 2024-02-11  8:48           ` Eli Zaretskii
  2024-02-11 14:49             ` Eric Abrahamsen
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-02-11  8:48 UTC (permalink / raw)
  To: Morgan Willcock; +Cc: eric, 68352

> Cc: 68352@debbugs.gnu.org
> From: Morgan Willcock <morgan@ice9.digital>
> Date: Thu, 11 Jan 2024 11:57:36 +0000
> 
> I've attached a patch which is essentially the same as Eric's suggestion
> except that, the original comment is kept, the HOW argument of
> `font-lock-add-keywords' is set to t, and the code is restructured to
> avoid any font-lock changes until `font-lock-mode' is active.

Eric, how should we go about making some progress here?  Should the
proposed patch be installed?

Thanks.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords
  2024-02-11  8:48           ` Eli Zaretskii
@ 2024-02-11 14:49             ` Eric Abrahamsen
  0 siblings, 0 replies; 11+ messages in thread
From: Eric Abrahamsen @ 2024-02-11 14:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 68352-done, Morgan Willcock

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: 68352@debbugs.gnu.org
>> From: Morgan Willcock <morgan@ice9.digital>
>> Date: Thu, 11 Jan 2024 11:57:36 +0000
>> 
>> I've attached a patch which is essentially the same as Eric's suggestion
>> except that, the original comment is kept, the HOW argument of
>> `font-lock-add-keywords' is set to t, and the code is restructured to
>> avoid any font-lock changes until `font-lock-mode' is active.
>
> Eric, how should we go about making some progress here?  Should the
> proposed patch be installed?

It's already installed! I just neglected to close the bug, which I'm
doing now. Thanks for the bump.





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-02-11 14:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09 20:18 bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords Morgan Willcock
2024-01-09 21:44 ` Eric Abrahamsen
2024-01-09 22:21   ` Morgan Willcock
2024-01-10  5:25     ` Eric Abrahamsen
2024-01-10 15:21       ` Eric Abrahamsen
2024-01-10 18:51         ` Eric Abrahamsen
2024-01-10 19:20           ` Morgan Willcock
2024-01-10 22:16       ` Morgan Willcock
2024-01-11 11:57         ` Morgan Willcock
2024-02-11  8:48           ` Eli Zaretskii
2024-02-11 14:49             ` Eric Abrahamsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).