aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMichael Albinus2025-03-14 16:31:51 +0100
committerMichael Albinus2025-03-14 16:31:51 +0100
commit24ffcbb3da9a010cf564bb496af3f5ce0b805f17 (patch)
tree526559c170333bcaf9241d693e19aef863dd7d88 /doc
parent21371aa106e6924377e916237d8418bfff2a754c (diff)
downloademacs-24ffcbb3da9a010cf564bb496af3f5ce0b805f17.tar.gz
emacs-24ffcbb3da9a010cf564bb496af3f5ce0b805f17.zip
Improve tramp-*-with-sudo commands
* doc/emacs/dired.texi (Dired Visiting): Add tramp-dired-find-file-with-sudo. * doc/emacs/files.texi (Reverting): Add tramp-revert-buffer-with-sudo. * doc/misc/tramp.texi (Ad-hoc multi-hops): Extend wrt `tramp-*-with-sudo' commands. * etc/NEWS: Add tramp-dired-find-file-with-sudo. Fix typos. * lisp/bindings.el (ctl-x-x-map): * lisp/dired.el (dired-mode-map): Add "@" binding. (Bug#76974) * lisp/net/tramp-cmds.el (dired-get-file-for-visit): Declare. (with-tramp-file-name-with-method): New macro. (tramp-revert-buffer-with-sudo): Autoload. Preserve position. Use `with-tramp-file-name-with-method'. (tramp-dired-find-file-with-sudo): New command.
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/dired.texi8
-rw-r--r--doc/emacs/files.texi9
-rw-r--r--doc/misc/tramp.texi24
3 files changed, 33 insertions, 8 deletions
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 07142e71713..f52b001c121 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -460,6 +460,14 @@ View the file described on the current line, with View mode
460(@code{dired-view-file}). View mode provides convenient commands to 460(@code{dired-view-file}). View mode provides convenient commands to
461navigate the buffer but forbids changing it; @xref{View Mode}. 461navigate the buffer but forbids changing it; @xref{View Mode}.
462 462
463@item @@
464@kindex @@ @r{(Dired)}
465@findex tramp-dired-find-file-with-sudo
466Open the file described on the current line, with root permissions
467(@code{tramp-dired-find-file-with-sudo}). Calling it with the @kbd{C-u}
468prefix argument asks for another Tramp method interactively but
469@option{sudo}. @xref{Ad-hoc multi-hops, Tramp,, tramp, The Tramp Manual}.
470
463@item ^ 471@item ^
464@kindex ^ @r{(Dired)} 472@kindex ^ @r{(Dired)}
465@findex dired-up-directory 473@findex dired-up-directory
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index d11d7767353..9b2ce5c5ee2 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1174,6 +1174,15 @@ the major mode actually turned on as result of reverting a buffer
1174depends on mode remapping, and could be different from the original mode 1174depends on mode remapping, and could be different from the original mode
1175if you customized @code{major-mode-remap-alist} in-between. 1175if you customized @code{major-mode-remap-alist} in-between.
1176 1176
1177@cindex reverting with root permissions
1178@findex tramp-revert-buffer-with-sudo
1179@kindex C-x x @@
1180A variant of reverting a buffer is visiting it by the
1181@code{tramp-revert-buffer-with-sudo} (@kbd{C-x x @@}) command. It
1182reopens the file or Dired buffer with root permissions. With a prefix
1183argument of @kbd{C-u}, you could change the default Tramp method
1184(@option{sudo}). @xref{Ad-hoc multi-hops, Tramp,, tramp, The Tramp Manual}.
1185
1177@node Auto Revert 1186@node Auto Revert
1178@section Auto Revert: Keeping buffers automatically up-to-date 1187@section Auto Revert: Keeping buffers automatically up-to-date
1179@cindex Global Auto Revert mode 1188@cindex Global Auto Revert mode
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 81feb56ec31..6e66de552de 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -3928,23 +3928,31 @@ containers on the remote host.
3928 3928
3929A common use case for ad-hoc specifications is to visit a file or a 3929A common use case for ad-hoc specifications is to visit a file or a
3930directory with proper permissions, for example with the @option{sudo} 3930directory with proper permissions, for example with the @option{sudo}
3931method. The command @code{tramp-revert-buffer-with-sudo} supports 3931method. The commands @code{tramp-revert-buffer-with-sudo} (@kbd{C-x x
3932this. 3932@@}), and @code{tramp-dired-find-file-with-sudo} (@kbd{@@} in
3933@code{dired-mode}) support this.
3933 3934
3935@kindex C-x x @@
3934@deffn Command tramp-revert-buffer-with-sudo 3936@deffn Command tramp-revert-buffer-with-sudo
3935This command shows the current buffer with @option{sudo} permissions. 3937This command shows the current buffer with @option{sudo} permissions.
3936The buffer must either visit a file, or a directory 3938The buffer must either visit a file, or a directory
3937(@code{dired-mode}). 3939(@code{dired-mode}).
3938@end deffn 3940@end deffn
3939 3941
3942@kindex @@ @r{(in dired})
3943@deffn Command tramp-dired-find-file-with-sudo
3944In @code{dired-mode}, visit the file or directory named on this line.
3945This is performed with @option{sudo} permissions.
3946@end deffn
3947
3940@defopt tramp-file-name-with-method 3948@defopt tramp-file-name-with-method
3941The method @code{tramp-revert-buffer-with-sudo} shows an alternate 3949The method used in @code{tramp-revert-buffer-with-sudo} and
3942buffer. It defaults to @option{sudo}, other valid methods are 3950@code{tramp-dired-find-file-with-sudo}. It defaults to @option{sudo},
3943@option{su}, @option{doas}, @option{run0}, and @option{ksu}. 3951other valid methods are @option{su}, @option{doas}, @option{run0}, and
3952@option{ksu}.
3944 3953
3945@lisp 3954If a command is called with a prefix argument @kbd{C-u}, the option's
3946(customize-set-variable 'tramp-file-name-with-method "doas") 3955value is read interactively.
3947@end lisp
3948@end defopt 3956@end defopt
3949 3957
3950These methods apply the user @samp{root} as default. If another user 3958These methods apply the user @samp{root} as default. If another user