diff options
| author | Michael Albinus | 2025-03-14 16:31:51 +0100 |
|---|---|---|
| committer | Michael Albinus | 2025-03-14 16:31:51 +0100 |
| commit | 24ffcbb3da9a010cf564bb496af3f5ce0b805f17 (patch) | |
| tree | 526559c170333bcaf9241d693e19aef863dd7d88 /doc | |
| parent | 21371aa106e6924377e916237d8418bfff2a754c (diff) | |
| download | emacs-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.texi | 8 | ||||
| -rw-r--r-- | doc/emacs/files.texi | 9 | ||||
| -rw-r--r-- | doc/misc/tramp.texi | 24 |
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 |
| 461 | navigate the buffer but forbids changing it; @xref{View Mode}. | 461 | navigate 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 | ||
| 466 | Open 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} | ||
| 468 | prefix 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 | |||
| 1174 | depends on mode remapping, and could be different from the original mode | 1174 | depends on mode remapping, and could be different from the original mode |
| 1175 | if you customized @code{major-mode-remap-alist} in-between. | 1175 | if 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 @@ | ||
| 1180 | A variant of reverting a buffer is visiting it by the | ||
| 1181 | @code{tramp-revert-buffer-with-sudo} (@kbd{C-x x @@}) command. It | ||
| 1182 | reopens the file or Dired buffer with root permissions. With a prefix | ||
| 1183 | argument 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 | ||
| 3929 | A common use case for ad-hoc specifications is to visit a file or a | 3929 | A common use case for ad-hoc specifications is to visit a file or a |
| 3930 | directory with proper permissions, for example with the @option{sudo} | 3930 | directory with proper permissions, for example with the @option{sudo} |
| 3931 | method. The command @code{tramp-revert-buffer-with-sudo} supports | 3931 | method. The commands @code{tramp-revert-buffer-with-sudo} (@kbd{C-x x |
| 3932 | this. | 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 |
| 3935 | This command shows the current buffer with @option{sudo} permissions. | 3937 | This command shows the current buffer with @option{sudo} permissions. |
| 3936 | The buffer must either visit a file, or a directory | 3938 | The 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 | ||
| 3944 | In @code{dired-mode}, visit the file or directory named on this line. | ||
| 3945 | This is performed with @option{sudo} permissions. | ||
| 3946 | @end deffn | ||
| 3947 | |||
| 3940 | @defopt tramp-file-name-with-method | 3948 | @defopt tramp-file-name-with-method |
| 3941 | The method @code{tramp-revert-buffer-with-sudo} shows an alternate | 3949 | The method used in @code{tramp-revert-buffer-with-sudo} and |
| 3942 | buffer. 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}. | 3951 | other valid methods are @option{su}, @option{doas}, @option{run0}, and |
| 3952 | @option{ksu}. | ||
| 3944 | 3953 | ||
| 3945 | @lisp | 3954 | If a command is called with a prefix argument @kbd{C-u}, the option's |
| 3946 | (customize-set-variable 'tramp-file-name-with-method "doas") | 3955 | value is read interactively. |
| 3947 | @end lisp | ||
| 3948 | @end defopt | 3956 | @end defopt |
| 3949 | 3957 | ||
| 3950 | These methods apply the user @samp{root} as default. If another user | 3958 | These methods apply the user @samp{root} as default. If another user |