emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f8e9993: Allow inhibiting 'auto-save-visited-mode' on a per-buffe


From: Philipp Stephani
Subject: master f8e9993: Allow inhibiting 'auto-save-visited-mode' on a per-buffer basis.
Date: Mon, 25 May 2020 15:15:21 -0400 (EDT)

branch: master
commit f8e99938ec41a9af8d42b2ed78af1370fc2c1bc2
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>

    Allow inhibiting 'auto-save-visited-mode' on a per-buffer basis.
    
    At least for me, 'auto-save-visited-mode' is very slow and blocks user
    interaction for files visited over TRAMP.  Therefore, I'd like a
    mechanism to disable it for some buffers (namely, those visiting
    remote files).
    
    * (auto-save-visited-mode): Document that 'auto-save-visited-mode' can
    be set to nil buffer-locally.
    
    * etc/NEWS: Document new behavior.
---
 etc/NEWS      | 3 +++
 lisp/files.el | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 4bc00cc..e09f32a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -98,6 +98,9 @@ shows equivalent key bindings for all commands that have them.
 'gomoku-move-sw' and 'gomoku-move-ne' now work correctly, and
 horizontal movements now stop at the edge of the board.
 
+** Autosaving via 'auto-save-visited-mode' can now be inhibited by
+setting the variable 'auto-save-visited-mode' buffer-locally to nil.
+
 
 * Changes in Specialized Modes and Packages in Emacs 28.1
 
diff --git a/lisp/files.el b/lisp/files.el
index dba704f..cb37047 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -430,7 +430,13 @@ idle for `auto-save-visited-interval' seconds."
 
 Unlike `auto-save-mode', this mode will auto-save buffer contents
 to the visited files directly and will also run all save-related
-hooks.  See Info node `Saving' for details of the save process."
+hooks.  See Info node `Saving' for details of the save process.
+
+You can also set the buffer-local value of the variable
+`auto-save-visted-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."
   :group 'auto-save
   :global t
   (when auto-save--timer (cancel-timer auto-save--timer))
@@ -441,6 +447,7 @@ hooks.  See Info node `Saving' for details of the save 
process."
            #'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))))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]