From 4b8b7bb5cfc27b88fdf892a87931f5b89ff8c4a3 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 15 Mar 2025 12:43:35 +0100 Subject: [PATCH] ; 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'. --- doc/misc/tramp.texi | 6 ++++++ lisp/net/tramp-cmds.el | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 6e66de552de..a2f998753b7 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -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 diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index be122642b96..d9903783f2f 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -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'