From 3631355dcb97ccbf24dd7f7ca6efb97d78e0c511 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 5 Jul 2022 14:16:08 +0200 Subject: [PATCH] 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) --- etc/NEWS | 5 +++++ lisp/files.el | 8 ++++++++ 2 files changed, 13 insertions(+) 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)))))))) -- 2.39.5