]> git.eshelyaron.com Git - emacs.git/commitdiff
New user option auto-save-visited-remote-files
authorStefan Kangas <stefan@marxist.se>
Tue, 5 Jul 2022 12:16:08 +0000 (14:16 +0200)
committerStefan Kangas <stefan@marxist.se>
Tue, 5 Jul 2022 12:51:21 +0000 (14:51 +0200)
* lisp/files.el (auto-save-visited-remote-files): New user option.
(auto-save-visited-mode): Use above new variable to decide whether
or not to save remote files.  (Bug#41333)

etc/NEWS
lisp/files.el

index 5926148648b434fecd2948408192eb2140a2ff47..c5f6987dcf0dab5e02c400d5639c5b429f97ef13 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2008,6 +2008,11 @@ This user option is a predicate function which is called by
 You can use it to automatically save only specific buffers, for
 example buffers using a particular mode or in some directory.
 
+---
+*** New user option 'auto-save-visited-remote-files'.
+This user option controls whether or not 'auto-save-visited-mode' will
+save remote buffers.  The default is t.
+
 +++
 *** New package vtable.el for formatting tabular data.
 This package allows formatting data using variable-pitch fonts.
index 55c50c33b4da1f5a122bb1918821262a122c2055..794305520dbb315b000b1e663c754467d5b4d800 100644 (file)
@@ -468,6 +468,12 @@ true."
   :risky t
   :version "29.1")
 
+(defcustom auto-save-visited-remote-files t
+  "If non-nil, `auto-save-visited-mode' will save remote files."
+  :group 'auto-save
+  :type 'boolean
+  :version "29.1")
+
 (define-minor-mode auto-save-visited-mode
   "Toggle automatic saving to file-visiting buffers on or off.
 
@@ -501,6 +507,8 @@ For more details, see Info node `(emacs) Auto Save Files'."
                   auto-save-visited-mode
                   (not (and buffer-auto-save-file-name
                             auto-save-visited-file-name))
+                  (or (not (file-remote-p buffer-file-name))
+                      auto-save-visited-remote-files)
                   (or (not (functionp auto-save-visited-predicate))
                       (funcall auto-save-visited-predicate))))))))