mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Add `completion-predicate' to some Tramp commands
* lisp/net/tramp-cmds.el (tramp-cleanup-this-connection) (tramp-rename-these-files): Add property `completion-predicate'. * lisp/net/tramp.el (tramp-command-completion-p): New defun.
This commit is contained in:
parent
277a254a42
commit
0fd206badc
2 changed files with 21 additions and 0 deletions
|
|
@ -144,11 +144,18 @@ When called interactively, a Tramp connection has to be selected."
|
|||
;;;###tramp-autoload
|
||||
(defun tramp-cleanup-this-connection ()
|
||||
"Flush all connection related objects of the current buffer's connection."
|
||||
;; (declare (completion tramp-command-completion-p)))
|
||||
(interactive)
|
||||
(and (tramp-tramp-file-p default-directory)
|
||||
(tramp-cleanup-connection
|
||||
(tramp-dissect-file-name default-directory 'noexpand))))
|
||||
|
||||
;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form.
|
||||
;;;###tramp-autoload
|
||||
(function-put
|
||||
#'tramp-cleanup-this-connection 'completion-predicate
|
||||
#'tramp-command-completion-p)
|
||||
|
||||
;;;###tramp-autoload
|
||||
(defvar tramp-cleanup-all-connections-hook nil
|
||||
"List of functions to be called after all Tramp connections are cleaned up.")
|
||||
|
|
@ -431,6 +438,7 @@ Interactively, TARGET is selected from `tramp-default-rename-alist'
|
|||
without confirmation if the prefix argument is non-nil.
|
||||
|
||||
For details, see `tramp-rename-files'."
|
||||
;; (declare (completion tramp-command-completion-p))
|
||||
(interactive
|
||||
(let ((source default-directory)
|
||||
target
|
||||
|
|
@ -461,6 +469,11 @@ For details, see `tramp-rename-files'."
|
|||
|
||||
(tramp-rename-files default-directory target))
|
||||
|
||||
;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form.
|
||||
;;;###tramp-autoload
|
||||
(function-put
|
||||
#'tramp-rename-these-files 'completion-predicate #'tramp-command-completion-p)
|
||||
|
||||
;; Tramp version is useful in a number of situations.
|
||||
|
||||
;;;###tramp-autoload
|
||||
|
|
|
|||
|
|
@ -2591,6 +2591,14 @@ Add operations defined in `HANDLER-alist' to `tramp-file-name-handler'."
|
|||
|
||||
;;; File name handler functions for completion mode:
|
||||
|
||||
;; This function takes action since Emacs 28.1, when
|
||||
;; `read-extended-command-predicate' is set to
|
||||
;; `command-completion-default-include-p'.
|
||||
(defun tramp-command-completion-p (_symbol buffer)
|
||||
"A predicate for Tramp interactive commands.
|
||||
They are completed by \"M-x TAB\" only if the current buffer is remote."
|
||||
(with-current-buffer buffer (tramp-tramp-file-p default-directory)))
|
||||
|
||||
(defun tramp-connectable-p (vec-or-filename)
|
||||
"Check, whether it is possible to connect the remote host w/o side-effects.
|
||||
This is true, if either the remote host is already connected, or if we are
|
||||
|
|
|
|||
Loading…
Reference in a new issue