Variable: auto-save-visited-mode-hook
auto-save-visited-mode-hook is a customizable variable defined in
files.el.gz.
Value
nil
Documentation
Hook run after entering or leaving auto-save-visited-mode(var)/auto-save-visited-mode(fun).
No problems result if this variable is not bound.
add-hook automatically binds it. (This is true for all hook variables.)
Source Code
;; Defined in /usr/src/emacs/lisp/files.el.gz
(define-minor-mode auto-save-visited-mode
"Toggle automatic saving of file-visiting buffers to their files.
When this mode is enabled, file-visiting buffers are automatically
saved to their files. This is in contrast to `auto-save-mode', which
auto-saves those buffers to a separate file, leaving the original
file intact. See Info node `Saving' for details of the save process.
The user option `auto-save-visited-interval' controls how often to
auto-save a buffer into its visited file.
You can use `auto-save-visited-predicate' to control which
buffers are saved.
You can also set the buffer-local value of the variable
`auto-save-visited-mode' to nil. A buffer where the buffer-local
value of this variable is nil is ignored for the purpose of
`auto-save-visited-mode', even if `auto-save-visited-mode' is
enabled.
For more details, see Info node `(emacs) Auto Save Files'."
:group 'auto-save
:global t
(when auto-save--timer (cancel-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 ()
(and buffer-file-name
auto-save-visited-mode
(not (and buffer-auto-save-file-name
auto-save-visited-file-name))
(or (not (file-remote-p buffer-file-name))
(not remote-file-name-inhibit-auto-save-visited))
(or (not (functionp auto-save-visited-predicate))
(funcall auto-save-visited-predicate))))))))