From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#64439: 28.2; auto-fill-mode gets turned on all over the place Date: Sun, 09 Jul 2023 09:45:29 +0300 Message-ID: <83edlhbn1y.fsf@gnu.org> References: <83h6qlm0oc.fsf@gnu.org> <1034974.1688399705@warthog.procyon.org.uk> <1211099.1688406521@warthog.procyon.org.uk> <837crgn90u.fsf@gnu.org> <11d9848d-5a70-c1e5-cbc8-e00341889398@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4936"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dhowells@redhat.com, 64439@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 09 08:46:32 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qIOBj-000155-GN for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 Jul 2023 08:46:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIOBJ-0007ZC-Jz; Sun, 09 Jul 2023 02:46:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIOBI-0007Yy-9p for bug-gnu-emacs@gnu.org; Sun, 09 Jul 2023 02:46:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIOBI-00082B-1b for bug-gnu-emacs@gnu.org; Sun, 09 Jul 2023 02:46:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qIOBG-0007cH-Hu for bug-gnu-emacs@gnu.org; Sun, 09 Jul 2023 02:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Jul 2023 06:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64439 X-GNU-PR-Package: emacs Original-Received: via spool by 64439-submit@debbugs.gnu.org id=B64439.168888513329228 (code B ref 64439); Sun, 09 Jul 2023 06:46:02 +0000 Original-Received: (at 64439) by debbugs.gnu.org; 9 Jul 2023 06:45:33 +0000 Original-Received: from localhost ([127.0.0.1]:45677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qIOAm-0007bM-QD for submit@debbugs.gnu.org; Sun, 09 Jul 2023 02:45:33 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qIOAk-0007b7-Ja for 64439@debbugs.gnu.org; Sun, 09 Jul 2023 02:45:31 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIOAe-0007pe-KJ; Sun, 09 Jul 2023 02:45:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=cCAE3Ftp3Aj4zSREiDvsduCIWmOeoQLxdgema8yh4lk=; b=q3DDraaoOY+eJolhmIXm ooGn45yqbYISJim08ikh+XNXy+ZQ0tn48oJJSyqPDGpSfn60bJ0mVvMUJOtQfI+6qk8TioH7AaNzB 1TL0anhadHhTcJKEBFwXKdaXBdflpNOa8+gHbHb5zM2e859sM3sxYYUM05vrrOnt/oeUqeYo3RmT8 TpSZaNoFJT83ps0W+6Lyt79okR9oFK+zXqm6poXsb1J0wrD6KhzJ0INRkqUl2S9W04YYUnNdSTvTh qTUT4JfiWZhIZQ/Bqhv5VqYi/qZvW7sqoFBF2LWXFNxfTWrmZ0jEn2wAwqJIbn//rfOCyHodD+iYK O1nvg165Ynbjjw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIOAc-0003lY-Eo; Sun, 09 Jul 2023 02:45:24 -0400 In-Reply-To: <11d9848d-5a70-c1e5-cbc8-e00341889398@gmail.com> (message from Jim Porter on Sat, 8 Jul 2023 22:57:12 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264818 Archived-At: > Date: Sat, 8 Jul 2023 22:57:12 -0700 > Cc: 64439@debbugs.gnu.org > From: Jim Porter > > 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?