mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 04:10:54 -08:00
New user option remote-file-name-inhibit-auto-save
* doc/misc/tramp.texi (Auto-save File Lock and Backup): Mention remote-file-name-inhibit-auto-save. (Frequently Asked Questions): Describe, how to suppress auto-save. * etc/NEWS: Add remote-file-name-inhibit-auto-save. * lisp/simple.el (remote-file-name-inhibit-auto-save): New defcustom. (auto-save-mode): Handle it. (Bug#62260) * lisp/net/tramp-integration.el (tramp-set-connection-local-variables-for-buffer): Declare. (find-file-hook): Add `tramp-set-connection-local-variables-for-buffer'.
This commit is contained in:
parent
117a29fd18
commit
b19d040a4f
4 changed files with 61 additions and 1 deletions
|
|
@ -3190,6 +3190,11 @@ auto-saved files to the same directory as the original file.
|
|||
Alternatively, set the user option @code{tramp-auto-save-directory}
|
||||
to direct all auto saves to that location.
|
||||
|
||||
@c Since Emacs 30.
|
||||
@vindex remote-file-name-inhibit-auto-save
|
||||
If you want to suppress auto-saving of remote files at all, set user
|
||||
option @code{remote-file-name-inhibit-auto-save} to non-@code{nil}.
|
||||
|
||||
@c Since Emacs 29.
|
||||
@vindex remote-file-name-inhibit-auto-save-visited
|
||||
An alternative to @code{auto-save-mode} is
|
||||
|
|
@ -4906,6 +4911,36 @@ Disable file locks. Set @code{remote-file-name-inhibit-locks} to
|
|||
@code{t} if you know that different Emacs sessions are not modifying
|
||||
the same remote file.
|
||||
|
||||
@item
|
||||
@vindex remote-file-name-inhibit-auto-save
|
||||
Keep auto-save files local. This is already the default configuration
|
||||
in Emacs, don't change it. If you want to disable auto-saving for
|
||||
remote files at all, set @code{remote-file-name-inhibit-auto-save} to
|
||||
@code{t}, but think about the consequences!
|
||||
|
||||
If you want to disable auto-saving just for selected connections, for
|
||||
example due to security considerations, use connection-local variables
|
||||
in order to set @code{buffer-auto-save-file-name}. If you, for
|
||||
example, want to disable auto-saving for all @option{sudo}
|
||||
connections, apply the following code.
|
||||
@ifinfo
|
||||
@xref{Connection Variables, , , emacs}.
|
||||
@end ifinfo
|
||||
|
||||
@lisp
|
||||
@group
|
||||
(connection-local-set-profile-variables
|
||||
'my-auto-save-profile
|
||||
'((buffer-auto-save-file-name . nil)))
|
||||
@end group
|
||||
|
||||
@group
|
||||
(connection-local-set-profiles
|
||||
'(:application tramp :protocol "sudo")
|
||||
'my-auto-save-profile)
|
||||
@end group
|
||||
@end lisp
|
||||
|
||||
@item
|
||||
Disable excessive traces. Set @code{tramp-verbose} to 3 or lower,
|
||||
default being 3. Increase trace levels temporarily when hunting for
|
||||
|
|
@ -5220,6 +5255,7 @@ HISTFILE=/dev/null
|
|||
@item
|
||||
Where are remote files trashed to?
|
||||
|
||||
@vindex remote-file-name-inhibit-delete-by-moving-to-trash
|
||||
Emacs can trash file instead of deleting
|
||||
@ifinfo
|
||||
them, @ref{Misc File Ops, Trashing , , emacs}.
|
||||
|
|
|
|||
5
etc/NEWS
5
etc/NEWS
|
|
@ -50,6 +50,11 @@ as it has in batch mode since Emacs 24.
|
|||
When non-nil, this option suppresses moving remote files to the local
|
||||
trash when deleting. Default is nil.
|
||||
|
||||
---
|
||||
** New user option 'remote-file-name-inhibit-auto-save'.
|
||||
If this user option is non-nil, 'auto-save-mode' will not auto-save
|
||||
remote buffers. The default is nil.
|
||||
|
||||
+++
|
||||
** New user option 'yes-or-no-prompt'.
|
||||
This allows the user to customize the prompt that is appended by
|
||||
|
|
|
|||
|
|
@ -42,9 +42,10 @@
|
|||
(declare-function shortdoc-add-function "shortdoc")
|
||||
(declare-function tramp-dissect-file-name "tramp")
|
||||
(declare-function tramp-file-name-equal-p "tramp")
|
||||
(declare-function tramp-tramp-file-p "tramp")
|
||||
(declare-function tramp-rename-files "tramp-cmds")
|
||||
(declare-function tramp-rename-these-files "tramp-cmds")
|
||||
(declare-function tramp-set-connection-local-variables-for-buffer "tramp")
|
||||
(declare-function tramp-tramp-file-p "tramp")
|
||||
(defvar eshell-path-env)
|
||||
(defvar ido-read-file-name-non-ido)
|
||||
(defvar info-lookup-alist)
|
||||
|
|
@ -549,6 +550,14 @@ See `tramp-process-attributes-ps-format'.")
|
|||
'(:application tramp :machine "localhost")
|
||||
local-profile))
|
||||
|
||||
;; Set connection-local variables for buffers visiting a file.
|
||||
|
||||
(add-hook 'find-file-hook #'tramp-set-connection-local-variables-for-buffer -50)
|
||||
(add-hook 'tramp-unload-hook
|
||||
(lambda ()
|
||||
(remove-hook
|
||||
'find-file-hook #'tramp-set-connection-local-variables-for-buffer)))
|
||||
|
||||
(add-hook 'tramp-unload-hook
|
||||
(lambda () (unload-feature 'tramp-integration 'force)))
|
||||
|
||||
|
|
|
|||
|
|
@ -9108,6 +9108,13 @@ presented."
|
|||
"Toggle buffer size display in the mode line (Size Indication mode)."
|
||||
:global t :group 'mode-line)
|
||||
|
||||
(defcustom remote-file-name-inhibit-auto-save nil
|
||||
"When nil, `auto-save-mode' will auto-save remote files.
|
||||
Any other value means that it will not."
|
||||
:group 'auto-save
|
||||
:type 'boolean
|
||||
:version "30.1")
|
||||
|
||||
(define-minor-mode auto-save-mode
|
||||
"Toggle auto-saving in the current buffer (Auto Save mode).
|
||||
|
||||
|
|
@ -9130,6 +9137,9 @@ For more details, see Info node `(emacs) Auto Save'."
|
|||
(setq buffer-auto-save-file-name
|
||||
(cond
|
||||
((null val) nil)
|
||||
((and buffer-file-name remote-file-name-inhibit-auto-save
|
||||
(file-remote-p buffer-file-name))
|
||||
nil)
|
||||
((and buffer-file-name auto-save-visited-file-name
|
||||
(not buffer-read-only))
|
||||
buffer-file-name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue