GNU bug report logs -
#64439
28.2; auto-fill-mode gets turned on all over the place
Previous Next
Full log
View this message in rfc822 format
> Date: Sat, 8 Jul 2023 22:57:12 -0700
> Cc: 64439 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
>
> On 7/3/2023 11:29 AM, Eli Zaretskii wrote:
> > I guess tracking down this problem will be harder, then. I hope I at
> > least gave you some ideas with which you will be able to construct a
> > suitable trap and find the culprit. Good luck!
>
> I got a backtrace when this happened to me. Outside of Emacs, I checked
> out a different Git branch, and then went back to Emacs and started
> typing into "etc/NEWS" (the specific file probably doesn't matter much),
> which triggered the supersession prompt as you'd expect. This was all
> over Tramp/SSH (again, not sure this is relevant).
>
> Here's the debug code I added to trace this:
>
> ----------------------------------------
>
> (use-package text-mode
> :preface
> (defun user/turn-on-auto-fill ()
> "Turn on auto-fill, but log a warning if it's not local to a buffer."
> (turn-on-auto-fill)
> (when (default-value 'auto-fill-function)
> (display-warning 'auto-fill :error
> "Default value of `auto-fill-function' was set!")
> (backtrace)))
>
> :hook (text-mode . user/turn-on-auto-fill))
>
> ----------------------------------------
>
> And here's the backtrace (plus a couple lines immediately preceding):
>
> ----------------------------------------
>
> NEWS changed on disk; really edit the buffer? (y, n, r or C-h) r
> Tramp: Inserting ‘/sshx:jim <at> remote:/home/jim/src/emacs/etc/NEWS’...done
> backtrace()
> (progn (display-warning 'auto-fill :error "Default value of
> `auto-fill-function' was set!") (backtrace))
> (if (default-value 'auto-fill-function) (progn (display-warning
> 'auto-fill :error "Default value of `auto-fill-function' was set!")
> (backtrace)))
> (when (default-value 'auto-fill-function) (display-warning 'auto-fill
> :error "Default value of `auto-fill-function' was set!") (backtrace))
> user/turn-on-auto-fill()
> run-hooks(change-major-mode-after-body-hook text-mode-hook
> outline-mode-hook)
> apply(run-hooks (change-major-mode-after-body-hook text-mode-hook
> outline-mode-hook))
> run-mode-hooks(outline-mode-hook)
> outline-mode()
> set-auto-mode-0(outline-mode nil)
> set-auto-mode()
> normal-mode(t)
> after-find-file(nil nil t nil nil)
> revert-buffer--default(nil t)
> revert-buffer(nil t)
>
> ask-user-about-supersession-threat("/sshx:jim <at> remote:~/src/emacs/etc/NEWS")
> tramp-handle-lock-file("/sshx:jim <at> remote:~/src/emacs/etc/NEWS")
> apply(tramp-handle-lock-file "/sshx:jim <at> remote:~/src/emacs/etc/NEWS")
> tramp-sh-file-name-handler(lock-file
> "/sshx:jim <at> remote:~/src/emacs/etc/NEWS")
> apply(tramp-sh-file-name-handler lock-file
> "/sshx:jim <at> remote:~/src/emacs/etc/NEWS")
> tramp-file-name-handler(lock-file
> "/sshx:jim <at> remote:~/src/emacs/etc/NEWS")
> newline(nil 1)
> funcall-interactively(newline nil 1)
> command-execute(newline)
>
> ----------------------------------------
>
> This might not be the most useful backtrace in the world, but hopefully
> it at least confirms one way this can happen. It's rare enough though
> that I can't reproduce it on command. It does lead me to believe that
> there's a bug with automatically-buffer-local variables, since
> 'turn-on-auto-fill' should Just Work here (and it typically does).
I must be missing something: why is the above deemed to be a bug?
AFAIU, you asked any text-mode derivative mode to turn on auto-fill,
and this is what happened here: normal-mode called outline-mode, which
turned on auto-fill. What am I missing?
This bug report was last modified 1 year and 344 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.