GNU bug report logs - #25478
26.0.50; No hooks are called when auto-saving

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Wed, 18 Jan 2017 21:40:01 UTC

Severity: wishlist

Found in version 26.0.50

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rgm <at> gnu.org, 25478 <at> debbugs.gnu.org
Subject: bug#25478: 26.0.50; No hooks are called when auto-saving
Date: Sat, 22 Apr 2017 19:01:50 +0000
[Message part 1 (text/plain, inline)]
Philipp Stephani <p.stephani2 <at> gmail.com> schrieb am So., 26. März 2017 um
21:17 Uhr:

> Eli Zaretskii <eliz <at> gnu.org> schrieb am So., 26. März 2017 um 20:46 Uhr:
>
>> > From: Philipp Stephani <p.stephani2 <at> gmail.com>
>> > Date: Sun, 26 Mar 2017 18:21:01 +0000
>> > Cc: 25478 <at> 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™ volunteering to reimplement
>> 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.
>

Here's a patch.
[Message part 2 (text/html, inline)]
[0001-Reimplement-auto-saving-to-visited-files.txt (text/plain, attachment)]

This bug report was last modified 4 years and 311 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.