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 19:17:53 +0000 Message-ID: References: <837f5q6rxq.fsf@gnu.org> <83wpbb98rc.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f403045f1518fd1cf0054ba71571 X-Trace: blaine.gmane.org 1490555961 28126 195.159.176.226 (26 Mar 2017 19:19:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 26 Mar 2017 19:19:21 +0000 (UTC) Cc: 25478@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 26 21:19:17 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 1csDh5-0006dx-05 for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Mar 2017 21:19:15 +0200 Original-Received: from localhost ([::1]:42024 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csDhA-0005tG-T6 for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Mar 2017 15:19:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csDgx-0005og-EB for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2017 15:19:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csDgs-00029g-Li for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2017 15:19:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47996) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1csDgs-00029a-Gj for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2017 15:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1csDgs-0005si-B2 for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2017 15:19: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 19:19: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.149055589122550 (code B ref 25478); Sun, 26 Mar 2017 19:19:02 +0000 Original-Received: (at 25478) by debbugs.gnu.org; 26 Mar 2017 19:18:11 +0000 Original-Received: from localhost ([127.0.0.1]:46195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1csDg3-0005re-15 for submit@debbugs.gnu.org; Sun, 26 Mar 2017 15:18:11 -0400 Original-Received: from mail-wr0-f174.google.com ([209.85.128.174]:36767) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1csDg1-0005rR-LQ for 25478@debbugs.gnu.org; Sun, 26 Mar 2017 15:18:10 -0400 Original-Received: by mail-wr0-f174.google.com with SMTP id w11so16098420wrc.3 for <25478@debbugs.gnu.org>; Sun, 26 Mar 2017 12:18:09 -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=HwQzFWOX7QgMWZqextTHc03rzRsc1PItkbdoNNnzxKM=; b=J61Z17VtLmN7kjAlZTVOTQrX1x+0XmrgSL/IxSvRZ+i1G5iI6ZKEeP1tRqnLzlGY9J kGaBZ3mg4+PjT1lM/eK9Jezg1ReSP20p8vsrJTIxUcf+E2dy9KeLCyNWRvNUb25L4dRg s+2Qi8I7xYuAGVuqD70lQhobANP/auV87ARweSDbcmmkc/5MEbnSt8iA1ccFemH+GnMD 7o/qZGMaNmjRLz1bkAS4zHUyU56+281Ef//EpVKD5njGhM0y1RYTm54hOIovTjus9Om6 R4h/DnSQlW9ZQt2HxLicmX3c8f3RnwagndnyZqFr9bIBXjtViMatQWfWIwMugpBluyZr 36YA== 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=HwQzFWOX7QgMWZqextTHc03rzRsc1PItkbdoNNnzxKM=; b=e5PtfC0nOe3cyPcVFmHUEx3UFB1TPmPmEr0wmNNb5aGqa3LgFx+qpXgAmC+phCiEGp Jo+VWt880sZIbocwAjwIxVQzTC6dhOrslo/Txp36uPxFjoNTDbc2cp3iUxpFJuP1z6e5 wPlvh8VEj6SLGVHlTJtBfP/wlzyByIuTqdbXJT5ML3cGpJsuYiLc5CwhPngDHZxPvKSj hYGwFjBfARmM7cSrITFtXhXzZn45Eokg4WLxkRE7WLZDVaidyV7UAwaKS2ZlVS01EvAB rvnnU6T6KMNaa3Q64GyhXauPRe8HM+KmklXs9amOnUvoT1qQO+Ev4X/H/96TEN6hbvBz EYOA== X-Gm-Message-State: AFeK/H2CRbU53y9xwfvzvy5ePQ9edLVQw4lJnOhL+nzgfQ6F6PG+Nmjk9KYKu1Xs40MHl9EapQ2JhcHckBjVAg== X-Received: by 10.223.164.201 with SMTP id h9mr16127302wrb.175.1490555884082; Sun, 26 Mar 2017 12:18:04 -0700 (PDT) In-Reply-To: <83wpbb98rc.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:130989 Archived-At: --f403045f1518fd1cf0054ba71571 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii schrieb am So., 26. M=C3=A4rz 2017 um 20:46 Uh= r: > > From: Philipp Stephani > > Date: Sun, 26 Mar 2017 18:21:01 +0000 > > Cc: 25478@debbugs.gnu.org > > > > 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? > > As I wrote, I'm also okay with Someone=E2=84=A2 volunteering to reimpleme= nt > this option such that it invokes basic-save-buffer instead. > > A minor mode that you describe would also be fine, but then it should > probably disable auto-saving if auto-save-visited-file-name is set, > right? > Sounds reasonable. I'll try to come up with something by next weekend. Probably it will be just (defvar auto-save--timer nil) (defcustom auto-save-visited-interval 5 "seconds" :group 'files :type 'number :set (lambda (symbol value) (set-default symbol value) (when auto-save--timer (timer-set-idle-time auto-save--timer value :repeat)))) (define-minor-mode auto-save-visited-mode nil :group 'files :global t (when auto-save--timer (kill-timer auto-save--timer)) (setq auto-save--timer (when auto-save-visited-mode (run-with-idle-timer auto-save-visited-interval :repeat #'save-some-buffers :no-prompt (lambda () (not (and buffer-auto-save-file-name auto-save-visited-file-name))))))) but it will also need tests and documentation, which take a bit more time. --f403045f1518fd1cf0054ba71571 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= So., 26. M=C3=A4rz 2017 um 20:46=C2=A0Uhr:
> From: Philipp Stephani <p.stephani2@gmail.com><= br class=3D"gmail_msg"> > Date: Sun, 26 Mar 2017 18:21:01 +0000
> Cc: 25478@debbugs.gnu.org
>
>=C2=A0 All in all, I think this option is subtly dangerous and should b= e
>=C2=A0 either deprecated or completely reimplemented to invoke
>=C2=A0 basic-save-buffer instead. I'm quite sure this option made s= ense in
>=C2=A0 the past, when complications with encoding and save-related hook= s
>=C2=A0 didn't exist, but that is no longer the case in Emacs these = days.
>=C2=A0 If someone thinks using this option will allow them not to bothe= r with
>=C2=A0 saving their edits, they are in for an unpleasant surprise.
>
> That's quite unfortunate, as not having to bother with saving edit= s 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?

As I wrote, I'm also okay with Someone=E2=84=A2 volunteering to reimple= ment
this option such that it invokes basic-save-buffer instead.

A minor mode that you describe would also be fine, but then it should
probably disable auto-saving if auto-save-visited-file-name is set,
right?

Sounds reaso= nable. I'll try to come up with something by next weekend. Probably it = will be just=C2=A0

(defvar auto-save--timer nil)
(defcustom auto-save-visited-interval 5
=C2=A0 "= ;seconds"
=C2=A0 :group 'files
=C2=A0 :type &#= 39;number
=C2=A0 :set (lambda (symbol value)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(set-default symbol value)
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(when auto-save--timer
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(timer-set-idle-time auto-save--timer value :repeat))))=
(define-minor-mode auto-save-visited-mode nil
=C2= =A0 :group 'files
=C2=A0 :global t
=C2=A0 (when aut= o-save--timer (kill-timer auto-save--timer))
=C2=A0 (setq auto-sa= ve--timer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when auto-save-visited-mod= e
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (run-with-idle-timer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0auto-save-visited-interval :rep= eat
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#'save-some-buff= ers :no-prompt
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(lambda (= )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(not (and buffe= r-auto-save-file-name auto-save-visited-file-name)))))))

but it will also need tests and documentation, which take a bit more= time.
--f403045f1518fd1cf0054ba71571--