summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2022-07-05 14:16:08 +0200
committerStefan Kangas <stefan@marxist.se>2022-07-05 14:51:21 +0200
commit3631355dcb97ccbf24dd7f7ca6efb97d78e0c511 (patch)
tree864fa93cccead600355eec7b2da994c079a37580
parentac7f76528f2f2e2f6e77bc25e7040eb3b07e45c0 (diff)
downloademacs-3631355dcb97ccbf24dd7f7ca6efb97d78e0c511.tar.gz
emacs-3631355dcb97ccbf24dd7f7ca6efb97d78e0c511.tar.bz2
emacs-3631355dcb97ccbf24dd7f7ca6efb97d78e0c511.zip
New user option auto-save-visited-remote-files
* 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)
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/files.el8
2 files changed, 13 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 5926148648b..c5f6987dcf0 100644
--- 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.
diff --git a/lisp/files.el b/lisp/files.el
index 55c50c33b4d..794305520db 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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))))))))