From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#25478: 26.0.50; No hooks are called when auto-saving Date: Sun, 26 Mar 2017 18:21:01 +0000 Message-ID: References: <837f5q6rxq.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f403045f57709cfdc4054ba64aff X-Trace: blaine.gmane.org 1490552536 3814 195.159.176.226 (26 Mar 2017 18:22:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 26 Mar 2017 18:22:16 +0000 (UTC) Cc: 25478@debbugs.gnu.org To: Eli Zaretskii , Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 26 20:22:09 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 1csCno-00005B-7D for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Mar 2017 20:22:08 +0200 Original-Received: from localhost ([::1]:41860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csCns-0003AY-Ce for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Mar 2017 14:22:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csCnl-0003AS-KY for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2017 14:22:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csCni-0002KG-Eb for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2017 14:22:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47953) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1csCni-0002K3-Bq for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2017 14:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1csCni-0004Ty-3q for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2017 14:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Mar 2017 18:22: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.149055248117159 (code B ref 25478); Sun, 26 Mar 2017 18:22:02 +0000 Original-Received: (at 25478) by debbugs.gnu.org; 26 Mar 2017 18:21:21 +0000 Original-Received: from localhost ([127.0.0.1]:46152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1csCn2-0004Sg-IX for submit@debbugs.gnu.org; Sun, 26 Mar 2017 14:21:20 -0400 Original-Received: from mail-wr0-f196.google.com ([209.85.128.196]:33553) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1csCmz-0004SH-Or for 25478@debbugs.gnu.org; Sun, 26 Mar 2017 14:21:18 -0400 Original-Received: by mail-wr0-f196.google.com with SMTP id 20so6707502wrx.0 for <25478@debbugs.gnu.org>; Sun, 26 Mar 2017 11:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=H/Ob7BoDUoAtl8CmICAvxx37Nu8nfFp0bitjJa66K8Q=; b=ITnTKwBoPNW+EHyELs7fT4Wc0eROnG0cPHTxdgBbxcF+A2zHyJhKZaCh17DaANhoxG wUJo2TFoOnDeVBgUhV2hyH5YBTwcbndoK8KRn1ukDWxkZyflD/0w6E0NIKl/8gaBXlDF 4S04F5bwjpwry0pmHiwIR3nUvyqyjwWqA5dxhGJugRRmJG4r8NozTOzI6d6M0aC6LsZf MvTMrmFtq9B0xdR2kfHXVKdmr317+flWwToBXyY0I0yoZs/0ubuNJq3QK5YMxZro9v0g fVUodXq39sMpRs9Cwep1a5RyaM40b5qLrqz/gCUK+dByY9dS0GhlGilRHG9K6xat4mpL 5fjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=H/Ob7BoDUoAtl8CmICAvxx37Nu8nfFp0bitjJa66K8Q=; b=lP9F/iiHvw3NrKHkVS5vP8oEagjZrtQW4AHz3ncMyTjVo8zYpk6B5/yBozNEjnJB6K KDyW815lClfVXk21PAZd4Mn+/7JcKJ4m7P9pxw1Wj7ouJcOCayUEnde3iL1PQn1yw68q ylsv+S7ETsJkReiwDPpLduwg3p0yLnZcnyq6FmLy2vYbVdhBkuxHGBkNZ3IPxiiv3sCw kLfol8yKFZBElJYSo/wlldF28UfZmqsEMwaapaz1l8BkMB5m/DHMfz6xi6ea8LKlf8Io BC1x9UFRJ3I8Ko2DIjAByHT3WWpwv97xxstTXwxvCvIWQIRjJb5dFrlPiE4ohE9yXZHK E9yA== X-Gm-Message-State: AFeK/H0n96dGFbkNqd0yWPsXdbNXd6GggkG6nwYsi9escc0/VrKPvo1ceyhSkhpkObO0xi8kAOAiy3wbM+XbOQ== X-Received: by 10.223.154.2 with SMTP id z2mr11492709wrb.136.1490552472008; Sun, 26 Mar 2017 11:21:12 -0700 (PDT) In-Reply-To: <837f5q6rxq.fsf@gnu.org> 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:130985 Archived-At: --f403045f57709cfdc4054ba64aff Content-Type: text/plain; charset=UTF-8 Eli Zaretskii schrieb am Fr., 20. Jan. 2017 um 09:45 Uhr: > > 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. > > That's quite unfortunate, as not having to bother with saving edits manually is a very desirable feature that I think Emacs should offer out of the box. If you really want to deprecate auto-save-visited-file-name, how about adding a simple global minor mode that invokes save-some-buffers from an idle timer to files.el? --f403045f57709cfdc4054ba64aff Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= Fr., 20. Jan. 2017 um 09:45=C2=A0Uhr:
> From: Glenn Morris <rgm@gnu.org>
> 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 rath= er than in
> > a separate auto-save file, set the variable
> > 'auto-save-visited-file-name' to a non-'nil' valu= e.=C2=A0 In this mode, there
> > is no real difference between auto-saving and explicit saving.&qu= ot;
> >
> > However, there is a significant difference between auto-saving an= d
> > explicit saving, even in this mode: auto-saving doesn't run > > before-save-hook, after-save-hook, write-contents-functions, or > > write-file-functions.=C2=A0 Either some of these hooks should be = run during
> > auto-saving if auto-save-visited-file-name is t, or new hooks sho= uld be
> > created to run in this case.
>
> The phrasing of the manual can easily be changed if it's creating<= br class=3D"gmail_msg"> > 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.=C2=A0 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.=C2=A0 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.=C2=A0 Auto-saving doesn't record the value, so if the us= er
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.=C2=A0 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.


That's quite u= nfortunate, as not having to bother with saving edits manually is a very de= sirable feature that I think Emacs should offer out of the box.
<= br>
If you really want to deprecate auto-save-visited-file-name, = how about adding a simple global minor mode that invokes save-some-buffers = from an idle timer to files.el?=C2=A0
--f403045f57709cfdc4054ba64aff--