Subject: Re: bug#25478: 26.0.50; No hooks are called when auto-saving

From: Philipp Stephani <[email-masked]>
Date: Sat, 29 Apr 2017 18:47:24 +0000

Eli Zaretskii <[email-masked]> schrieb am Fr., 28. Apr. 2017 um 11:28 Uhr:

> > From: Philipp Stephani <[email-masked]>
> > Date: Sat, 22 Apr 2017 19:01:50 +0000
> > Cc: [email-masked], [email-masked]
> >
> > Here's a patch.
>
> Thanks.  A few minor comments:
>
> > --- a/doc/emacs/files.texi
> > +++ b/doc/emacs/files.texi
> > @@ -1040,14 +1040,13 @@ Auto Save Files
> >  this happens, save the buffer with @kbd{C-x C-s}, or use @kbd{C-u 1 M-x
> >  auto-save-mode}.
> >
> > -@vindex auto-save-visited-file-name
> > +@vindex auto-save-visited-mode
>
> I wonder whether auto-save-files-mode is a better name, as the
> "visited" part looks now out of place.  (If you do rename it, please
> also rename the time-interval variable accordingly.)
>

I think the name should be sufficiently different from auto-save-mode so
that the modes can't be confused. auto-save-files-mode would be confusing,
because auto-save-mode also saves files. I think including the "visited"
word is useful here because it's the meaningful distinction between the
modes: one uses the visited file name, the other doesn't.

>
> > +in a separate auto-save file, enable the global minor mode
> > +@code{auto-save-visited-mode}.  In this mode, auto-saving is very
> > +similar to explicit saving.
>
> "Very similar" begs the question "what's the difference?"  If there
> are differences, let's describe them; if there aren't, let's say
> "identical to" or "the same as".
>

Done.

>
> >                                Note that this mode is orthogonal to the
> > +@code{auto-save} mode described above; you can enable both at the same
> > +time.
>
> But if auto-save mode is enabled and auto-save-visited-file-name is
> set, then this new mode will not auto-save, right?  This should be
> documented.
>

Done.

>
> > @@ -1091,6 +1090,13 @@ Auto Save Control
> >  a while; second, it may avoid some auto-saving while you are actually
> >  typing.
> >
> > +@vindex auto-save-visited-interval
>
> I suggest to mention this variable where you describe the new mode,
> since the two descriptions are several tens of lines apart.
>

Done.

>
> > +  When @code{auto-save-visited-mode} is enabled, Emacs will auto-save
> > +file-visiting buffers after five seconds of idle time.  You can
> > +customize the variable @code{auto-save-visited-interval} to change the
> > +idle time interval.  @code{auto-save-interval} and
> > +@code{auto-save-timeout} have no effect on this mode.
>
> I think the last sentence should be part of the description of the
> mode, not of the variable.  Doing so will also provide a good
> opportunity to mention auto-save-visited-interval.
>

Done.

>
> > +(defcustom auto-save-visited-interval 5
> > +  "Interval in seconds for `auto-save-visited-mode'.
> > +If `auto-save-visited-mode' is enabled, Emacs will save all
> > +buffers visiting a file to the visited file after it has been
> > +idle for `auto-save-visited-interval' seconds."
> > +  :group 'auto-save
> > +  :type 'number
> > +  :set (lambda (symbol value)
> > +         (set-default symbol value)
> > +         (when auto-save--timer
> > +           (timer-set-idle-time auto-save--timer value :repeat))))
>
> Please add a :version tag to new defcustoms.
>

Done.

>
> > +(define-minor-mode auto-save-visited-mode
> > +  "Toggle automatic saving to file-visiting buffers on or off.
> > +With a prefix argument ARG, enable regular saving of all buffers
> > +vising a file if ARG is positive, and disable it otherwise.
>    ^^^^^^
> A typo.
>

Done.