Subject: bug#58578: 29.0.50; Font lock randomly breaks in some buffers and gets worse over time

From: Stefan Kangas <[email-masked]>
Date: Mon, 17 Oct 2022 04:40:50 +0000

I'm seeing broken font lock in long running sessions, seemingly at
random.  After it goes on for a while, font lock breaks down completely
in some buffers, and it seemingly gets worse over time.  In some cases,
the only remedy has been to restart Emacs.

This has been going on for a couple of weeks at least, and I thought I
was doing something wrong, so I haven't reported it.  I also haven't
seriously tried to reproduce it in "emacs -Q", so I've only seen using
my own init file.  (I haven't made any changes in that configuration
recently that would obviously relate to font-locking.)

I've failed at my attempts to understand it, so I hope that someone can
help me with ideas on how to debug this.  What makes this a bit
discouraging to debug is that it usually only shows up after more than a
day of use (sometimes several days, AFAIR), and it's unbearable to work
in "emacs -Q" for that long.  I also have no idea where to even begin
looking.

I have seen it in more than one major mode, both built-in and
third-party modes (from the top of my head, I've seen it in `c-mode' and
`org-mode' too).

Here is a screenshot from `notmuch-message-mode', based on
`message-mode':