diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index c7ec228c1db..e8bede9d605 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -138,6 +138,11 @@ pcomplete-dir-ignore "A regexp of names to be disregarded during directory completion." :type '(choice regexp (const :tag "None" nil))) +(defcustom pcomplete-remote-ignore nil + "Whether to ignore remote file names." + :version "30.1" + :type 'boolean) + (define-obsolete-variable-alias 'pcomplete-ignore-case 'completion-ignore-case "28.1") @@ -924,7 +929,10 @@ pcomplete--entries (sort comps pcomplete-compare-entry-function))) ,@(cdr (completion-file-name-table s p a))) (let ((completion-ignored-extensions nil) - (completion-ignore-case completion-ignore-case)) + (completion-ignore-case completion-ignore-case) + (tramp-mode (and tramp-mode (not pcomplete-remote-ignore))) + (non-essential (not (file-remote-p s))) + (minibuffer-completing-file-name (not (file-remote-p s)))) (completion-table-with-predicate #'comint-completion-file-name-table pred 'strict s p a)))))) diff --git a/lisp/shell.el b/lisp/shell.el index 7ea9d1c2ead..17ab12dda6d 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -595,6 +595,8 @@ shell-completion-vars ;; Don't use pcomplete's defaulting mechanism, rely on ;; shell-dynamic-complete-functions instead. (setq-local pcomplete-default-completion-function #'ignore) + ;; Do not expand remote file names. + (setq-local pcomplete-remote-ignore t) (setq-local comint-input-autoexpand shell-input-autoexpand) ;; Not needed in shell-mode because it's inherited from comint-mode, but ;; placed here for read-shell-command.