From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25478: 26.0.50; No hooks are called when auto-saving Date: Fri, 20 Jan 2017 10:45:05 +0200 Message-ID: <837f5q6rxq.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1484901978 22770 195.159.176.226 (20 Jan 2017 08:46:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2017 08:46:18 +0000 (UTC) Cc: p.stephani2@gmail.com, 25478@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 20 09:46:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUUpm-0005Fb-Sq for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Jan 2017 09:46:11 +0100 Original-Received: from localhost ([::1]:53163 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUUpq-0004ZB-4q for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Jan 2017 03:46:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUUpj-0004Z5-Et for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 03:46:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUUpe-0005uS-FC for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 03:46:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37828) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cUUpe-0005uG-Bc for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 03:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cUUpe-0004zi-1l for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 03:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Jan 2017 08:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25478 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25478-submit@debbugs.gnu.org id=B25478.148490192619156 (code B ref 25478); Fri, 20 Jan 2017 08:46:02 +0000 Original-Received: (at 25478) by debbugs.gnu.org; 20 Jan 2017 08:45:26 +0000 Original-Received: from localhost ([127.0.0.1]:36027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUUp4-0004yu-FR for submit@debbugs.gnu.org; Fri, 20 Jan 2017 03:45:26 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUUp2-0004yh-U6 for 25478@debbugs.gnu.org; Fri, 20 Jan 2017 03:45:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUUos-0005Pt-Kr for 25478@debbugs.gnu.org; Fri, 20 Jan 2017 03:45:19 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUUos-0005Pj-Hh; Fri, 20 Jan 2017 03:45:14 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4127 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cUUor-0008On-JL; Fri, 20 Jan 2017 03:45:14 -0500 In-reply-to: (message from Glenn Morris on Thu, 19 Jan 2017 15:29:04 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128268 Archived-At: > From: Glenn Morris > Date: Thu, 19 Jan 2017 15:29:04 -0500 > Cc: 25478@debbugs.gnu.org > > Philipp Stephani wrote: > > > The Emacs manual states: > > > > "If you want auto-saving to be done in the visited file rather than in > > a separate auto-save file, set the variable > > 'auto-save-visited-file-name' to a non-'nil' value. In this mode, there > > is no real difference between auto-saving and explicit saving." > > > > However, there is a significant difference between auto-saving and > > explicit saving, even in this mode: auto-saving doesn't run > > before-save-hook, after-save-hook, write-contents-functions, or > > write-file-functions. Either some of these hooks should be run during > > auto-saving if auto-save-visited-file-name is t, or new hooks should be > > created to run in this case. > > The phrasing of the manual can easily be changed if it's creating > unreasonable expectations. I've done that now on the release branch. > Do you have a use case for autosave running hooks? > One could argue that it is a low-level > operation that should not be modifiable in this way. Auto-save has its own hook. But that's just the tip of an iceberg, because nowadays various modes can completely change what happens at save-buffer time by using the hooks mentioned above, and those hooks run only when basic-save-buffer is invoked; they won't be run during auto-saving. And there are other differences, too. E.g., if save-buffer asks the user for a suitable encoding, it will record the value used in buffer-file-coding-system, so that future saves reuse that automatically. Auto-saving doesn't record the value, so if the user doesn't change the buffer's file encoding manually, she will be prompted to provide an encoding on every auto-save. All in all, I think this option is subtly dangerous and should be either deprecated or completely reimplemented to invoke basic-save-buffer instead. I'm quite sure this option made sense in the past, when complications with encoding and save-related hooks didn't exist, but that is no longer the case in Emacs these days. If someone thinks using this option will allow them not to bother with saving their edits, they are in for an unpleasant surprise. (Not sure whether we should close this bug now that the documentation is fixed.)