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

From: Jim Porter <[email-masked]>
Date: Mon, 3 Jul 2023 11:14:10 -0700

On 7/3/2023 8:55 AM, David Howells wrote:
> 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.).

I've seen this too actually, but have had a hard time narrowing it down. 
I did something similar to Eli's suggestion a bit ago and did get a 
couple of data points, however:

* First, I have 'turn-on-auto-fill-mode' set on 'text-mode-hook'.

* It only seems to happen for me when a text-mode file was changed 
outside of Emacs, and then I press "r" (refresh) at the Emacs 
supersession prompt. This results in the mode being restarted (I think), 
which in turn calls 'turn-on-auto-fill-mode'. Occasionally, something 
gets messed up, and that function ends up setting the *default* value 
for 'auto-fill-function'.

* I usually notice this on files I'm editing over Tramp, but that might 
not be relevant since I use Tramp very heavily, and maybe I'm just 
getting "lucky".

I'm not sure, but perhaps there's a bug in 'set_internal'? There's some 
code in the 'SYMBOL_LOCALIZED' block of the switch statement in there 
that seems like it could relate to this, but I haven't had time to dig 
much into this, so that could be a red herring...

> In both cases, the emacs instances are typically running for multiple weeks
> till I need to reboot - or the issue becomes sufficiently irritating that I
> restart emacs.

Something like "(setq-default auto-fill-function nil)" should fix your 
Emacs session.