diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-19 16:48:59 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-19 16:48:59 -0700 |
commit | 07fcbb558d797272b9f43547da60beda485873a3 (patch) | |
tree | 77d5da14e9f9d9d8b1d877c70c01296fd3893796 /lisp/net/tramp-cmds.el | |
parent | c9bdeff3e45a7ac84a74a81bb048046f82dddc91 (diff) | |
parent | fb81c8c3adf8633f2f617c82f6019aef630860c7 (diff) | |
download | emacs-07fcbb558d797272b9f43547da60beda485873a3.tar.gz |
Merge remote-tracking branch 'origin/master' into athena/unstable
Diffstat (limited to 'lisp/net/tramp-cmds.el')
-rw-r--r-- | lisp/net/tramp-cmds.el | 68 |
1 files changed, 62 insertions, 6 deletions
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 097f25ea85e..6278fd302af 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -57,7 +57,9 @@ SYNTAX can be one of the symbols `default' (default), (all-completions "*tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list)))) (all-completions - "*debug tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list)))))) + "*debug tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list)))) + (all-completions + "*trace tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list)))))) (defun tramp-list-remote-buffers () "Return a list of all buffers with remote `default-directory'." @@ -144,11 +146,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.") @@ -201,7 +210,6 @@ This includes password cache, file cache, connection cache, buffers." (dolist (name (tramp-list-remote-buffers)) (when (bufferp (get-buffer name)) (kill-buffer name)))) -;;;###tramp-autoload (defcustom tramp-default-rename-alist nil "Default target for renaming remote buffer file names. This is an alist of cons cells (SOURCE . TARGET). The first @@ -224,7 +232,6 @@ expression which always matches." :type '(repeat (cons (choice :tag "Source regexp" regexp sexp) (choice :tag "Target name" string (const nil))))) -;;;###tramp-autoload (defcustom tramp-confirm-rename-file-names t "Whether renaming a buffer file name must be confirmed." :group 'tramp @@ -243,7 +250,7 @@ function returns nil" (host (or (file-remote-p string 'host) "")) item result) (while (setq item (pop tdra)) - (when (string-match-p (or (eval (car item)) "") string) + (when (string-match-p (or (eval (car item) t) "") string) (setq tdra nil result (format-spec @@ -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,11 +469,59 @@ 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) + +;; This function takes action since Emacs 28.1, when +;; `read-extended-command-predicate' is set to +;; `command-completion-default-include-p'. +;;;###tramp-autoload +(defun tramp-recompile-elpa-command-completion-p (_symbol _buffer) + "A predicate for `tramp-recompile-elpa'. +It is completed by \"M-x TAB\" only if package.el is loaded, and +Tramp is an installed ELPA package." + ;; We cannot apply `package-installed-p', this would also return the + ;; builtin package. + (and (assq 'tramp (bound-and-true-p package-alist)) + (tramp-compat-funcall 'package--user-installed-p 'tramp))) + +;;;###tramp-autoload +(defun tramp-recompile-elpa () + "Recompile the installed Tramp ELPA package. +This is needed if there are compatibility problems." + ;; (declare (completion tramp-recompile-elpa-command-completion-p)) + (interactive) + ;; We expect just one Tramp package is installed. + (when-let + ((dir (tramp-compat-funcall + 'package-desc-dir + (car (alist-get 'tramp (bound-and-true-p package-alist)))))) + (dolist (elc (directory-files dir 'full "\\.elc\\'")) + (delete-file elc)) + (with-current-buffer (get-buffer-create byte-compile-log-buffer) + (let ((inhibit-read-only t)) + (compilation-mode) + (goto-char (point-max)) + (insert "\f\n") + (call-process + (expand-file-name invocation-name invocation-directory) nil t t + "-Q" "-batch" "-L" dir + "--eval" (format "(byte-recompile-directory %S 0 t)" dir)) + (message "Package `tramp' recompiled."))))) + +;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. +;;;###tramp-autoload +(function-put + #'tramp-recompile-elpa 'completion-predicate + #'tramp-recompile-elpa-command-completion-p) + ;; Tramp version is useful in a number of situations. ;;;###tramp-autoload (defun tramp-version (arg) - "Print version number of tramp.el in minibuffer or current buffer." + "Print version number of tramp.el in echo area or current buffer." (interactive "P") (if arg (insert tramp-version) (message tramp-version))) @@ -616,7 +672,7 @@ buffer in your bug report. (insert "\nload-path shadows:\n==================\n") (ignore-errors (mapc - (lambda (x) (when (string-match-p "tramp" x) (insert x "\n"))) + (lambda (x) (when (tramp-compat-string-search "tramp" x) (insert x "\n"))) (split-string (list-load-path-shadows t) "\n"))) ;; Append buffers only when we are in message mode. |