Subject: Re: bug#64439: 28.2; auto-fill-mode gets turned on all over the place

From: Eli Zaretskii <[email-masked]>
Date: Mon, 03 Jul 2023 19:15:15 +0300

> Cc: [email-masked]
> From: David Howells <[email-masked]>
> Date: Mon, 03 Jul 2023 16:55:05 +0100
> 
> I'm seeing an issue in which auto-fill-mode gets turned on for all the buffers
> in a running emacs instance, including the command entry window (M-x, grep,
> compile, etc.).  This is a problem as it starts mangling the code I'm working
> on and making it harder to enter long commands (such as grep or compile
> commands).  I can turn it off manually on most buffers (though not the command
> window), but it immediately turns back on in a buffer if I have to reload it.
> 
> The problem has happened in several emacs instances now.  It shows up in the
> instances I've been using to edit C code and view patches.  It takes a little
> while for the problem to manifest when it does.  I'm not sure what triggers
> it.

Try evaluating this:

  (defun my-watcher (_symbol new-value operation where)
    (error "auto-fill-mode: %s %s %s" new-value operation where))
  (add-variable-watcher 'auto-fill-function 'my-watcher)
  (debug-on-entry 'my-watcher)

and run your sessions with this.  Whenever auto-fill-mode is turned
on, you will get a backtrace.  If you turn this mode yourself, and
don't want to be annoyed by entering the debugger each time, remove
the last line from the recipe: then you will just see a message when
auto-fill-mode is turned on, and will need to investigate which code
did that.