emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4b8b7bb5cfc 1/2: ; Minor Tramp changes


From: Michael Albinus
Subject: master 4b8b7bb5cfc 1/2: ; Minor Tramp changes
Date: Sat, 15 Mar 2025 07:55:26 -0400 (EDT)

branch: master
commit 4b8b7bb5cfc27b88fdf892a87931f5b89ff8c4a3
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    ; 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'



reply via email to

[Prev in Thread] Current Thread [Next in Thread]