unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: dhowells@redhat.com, 64439@debbugs.gnu.org
Subject: bug#64439: 28.2; auto-fill-mode gets turned on all over the place
Date: Sun, 09 Jul 2023 09:45:29 +0300	[thread overview]
Message-ID: <83edlhbn1y.fsf@gnu.org> (raw)
In-Reply-To: <11d9848d-5a70-c1e5-cbc8-e00341889398@gmail.com> (message from Jim Porter on Sat, 8 Jul 2023 22:57:12 -0700)

> Date: Sat, 8 Jul 2023 22:57:12 -0700
> Cc: 64439@debbugs.gnu.org
> From: Jim Porter <jporterbugs@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@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@remote:~/src/emacs/etc/NEWS")
>    tramp-handle-lock-file("/sshx:jim@remote:~/src/emacs/etc/NEWS")
>    apply(tramp-handle-lock-file "/sshx:jim@remote:~/src/emacs/etc/NEWS")
>    tramp-sh-file-name-handler(lock-file 
> "/sshx:jim@remote:~/src/emacs/etc/NEWS")
>    apply(tramp-sh-file-name-handler lock-file 
> "/sshx:jim@remote:~/src/emacs/etc/NEWS")
>    tramp-file-name-handler(lock-file 
> "/sshx:jim@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?





  reply	other threads:[~2023-07-09  6:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 15:55 bug#64439: 28.2; auto-fill-mode gets turned on all over the place David Howells
2023-07-03 16:15 ` Eli Zaretskii
2023-07-03 17:48 ` David Howells
2023-07-03 18:29   ` Eli Zaretskii
2023-07-09  5:57     ` Jim Porter
2023-07-09  6:45       ` Eli Zaretskii [this message]
2023-07-09 18:00         ` Jim Porter
2023-07-10 11:59           ` Eli Zaretskii
2023-07-10 16:00             ` Jim Porter
2023-07-10 17:28               ` Michael Albinus
2023-07-10 17:28             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-10 20:57               ` Jim Porter
2023-07-10 21:54                 ` Jim Porter
2023-07-10 23:53                   ` Jim Porter
2023-07-11 11:31                     ` Eli Zaretskii
2023-07-11 16:07                       ` Jim Porter
2023-07-11 18:44                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-12  2:23                           ` Jim Porter
2023-07-12 12:13                             ` Eli Zaretskii
2023-07-03 18:14 ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83edlhbn1y.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=64439@debbugs.gnu.org \
    --cc=dhowells@redhat.com \
    --cc=jporterbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).