[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 956821672eb: Support remote trash-directory
From: |
Michael Albinus |
Subject: |
master 956821672eb: Support remote trash-directory |
Date: |
Tue, 23 Apr 2024 07:54:27 -0400 (EDT) |
branch: master
commit 956821672eb5306d4eeeae0dc07df4664cef230a
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Support remote trash-directory
* doc/misc/tramp.texi (Frequently Asked Questions): Describe how
to manipulate trash-directory.
Explain tramp-inhibit-errors-if-setting-file-attributes-fail.
* lisp/files.el (move-file-to-trash): Use connection-local value
of `trash-directory'. (Bug#70421)
---
doc/misc/tramp.texi | 36 +++++++++++++++++++++++++++++++++++-
lisp/files.el | 5 +++--
2 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index b503ce13373..c87d0e70bb4 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -5444,7 +5444,7 @@ HISTFILE=/dev/null
Where are remote files trashed to?
@vindex remote-file-name-inhibit-delete-by-moving-to-trash
-Emacs can trash file instead of deleting
+Emacs can trash files instead of deleting
@ifinfo
them, @ref{Misc File Ops, Trashing , , emacs}.
@end ifinfo
@@ -5456,6 +5456,29 @@ option
@code{remote-file-name-inhibit-delete-by-moving-to-trash} is
non-@code{nil}, or it is a remote encrypted file (@pxref{Keeping files
encrypted}), which are deleted anyway.
+@c Since Emacs 30.
+@vindex trash-directory
+If you want to trash a remote file into a remote trash directory, you
+could configure the user option @code{trash-directory} to a
+connection-local value.
+@ifinfo
+@xref{Connection Variables, , , emacs}.
+@end ifinfo
+
+@lisp
+@group
+(connection-local-set-profile-variables
+ 'remote-trash-directory
+ '((trash-directory . "/sudo::~/.local/share/Trash")))
+@end group
+
+@group
+(connection-local-set-profiles
+ `(:application tramp :protocol "sudo" :machine ,system-name)
+ 'remote-trash-directory)
+@end group
+@end lisp
+
If Emacs is configured to use the XDG conventions for the trash
directory, remote files cannot be restored with the respective tools,
because those conventions don't specify remote paths. Such files must
@@ -5898,6 +5921,17 @@ If these errors can be ignored, set user option
non-@code{nil} value. This transforms the error into a warning.
+@item
+How to ignore errors when changing file attributes?
+
+@vindex tramp-inhibit-errors-if-setting-file-attributes-fail
+Sometimes, for example while saving remote files, errors appear when
+changing file attributes like permissions, time stamps, or ownership.
+If these errors can be ignored, set user option
+@code{tramp-inhibit-errors-if-setting-file-attributes-fail} to a
+non-@code{nil} value. This transforms the error into a warning.
+
+
@item
How to disable other packages from calling @value{tramp}?
diff --git a/lisp/files.el b/lisp/files.el
index 9f5ed85ce60..7dec67c5cf0 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -8812,9 +8812,10 @@ Otherwise, trash FILENAME using the freedesktop.org
conventions,
;; If `system-move-file-to-trash' is defined, use it.
(cond ((fboundp 'system-move-file-to-trash)
(system-move-file-to-trash filename))
- (trash-directory
+ ((connection-local-value trash-directory)
;; If `trash-directory' is non-nil, move the file there.
- (let* ((trash-dir (expand-file-name trash-directory))
+ (let* ((trash-dir (expand-file-name
+ (connection-local-value trash-directory)))
(fn (directory-file-name (expand-file-name filename)))
(new-fn (concat (file-name-as-directory trash-dir)
(file-name-nondirectory fn))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 956821672eb: Support remote trash-directory,
Michael Albinus <=