; Minor Tramp changes

* doc/misc/tramp.texi (Top): Add Key Index to menu.
(Key Index): New node.

* lisp/net/tramp-cmds.el (tramp-dired-buffer-command-completion-p):
New defun.
(tramp-dired-find-file-with-sudo): Add property
`completion-predicate'.
This commit is contained in:
Michael Albinus 2025-03-15 12:43:35 +01:00
parent 5d1b696e99
commit 4b8b7bb5cf
2 changed files with 22 additions and 0 deletions

View file

@ -101,6 +101,7 @@ For the developer:
* GNU Free Documentation License:: The license for this documentation.
* Function Index:: @value{tramp} functions.
* Variable Index:: User options and variables.
* Key Index:: Key bindings for @value{tramp} commands.
* Concept Index:: An item for each concept.
@detailmenu
@ -6811,6 +6812,11 @@ maintainers, analyzing the remote commands for performance analysis.
@printindex vr
@node Key Index
@unnumbered Key Index
@printindex ky
@node Concept Index
@unnumbered Concept Index
@printindex cp

View file

@ -708,14 +708,30 @@ If the buffer runs `dired', the buffer is reverted."
(dired-advertise)
(revert-buffer)))))
;; This function takes action, when `read-extended-command-predicate'
;; is set to `command-completion-default-include-p'.
(defun tramp-dired-buffer-command-completion-p (_symbol buffer)
"A predicate for Tramp interactive commands.
They are completed by `M-x TAB' only in Dired buffers."
(declare (tramp-suppress-trace t))
(with-current-buffer buffer
(tramp-dired-buffer-p)))
;;;###autoload
(defun tramp-dired-find-file-with-sudo ()
"In Dired, visit the file or directory named on this line.
This is performed with \"sudo\" permissions."
;; (declare (completion tramp-dired-buffer-command-completion-p))
(interactive)
(with-tramp-file-name-with-method
(find-file (tramp-file-name-with-sudo (dired-get-file-for-visit)))))
;; `tramp-dired-buffer-command-completion-p' is not autoloaded, and this
;; setting isn't either.
(function-put
#'tramp-dired-find-file-with-sudo 'completion-predicate
#'tramp-dired-buffer-command-completion-p)
;;; Recompile on ELPA
;; This function takes action, when `read-extended-command-predicate'