]> git.eshelyaron.com Git - emacs.git/commitdiff
New user option pcomplete-remote-file-ignore
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 20 Aug 2023 07:41:07 +0000 (09:41 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 20 Aug 2023 07:41:07 +0000 (09:41 +0200)
* etc/NEWS: Mention pcomplete-remote-file-ignore.

* lisp/pcomplete.el (pcomplete-remote-file-ignore):
New user option.
(pcomplete--entries): Use it.

* lisp/shell.el (shell-completion-vars):
Set 'pcomplete-remote-file-ignore'.

etc/NEWS
lisp/pcomplete.el
lisp/shell.el

index 6588299c5329840b2eb1044d08ce6df6c2c13df7..aa19c785ff15f8805ef766a6d00c614d8eb9653d 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -357,6 +357,14 @@ to load the edited aliases.
 Running 'rgrep' in Eshell now uses the Emacs grep facility instead of
 calling external rgrep.
 
+** Pcomplete
+
+---
+*** New user option 'pcomplete-remote-file-ignore'.
+When this option is non-nil, remote file names are not completed by
+Pcomplete.  Packages, like 'shell-mode', could set this in order to
+suppress remote file name completion at all.
+
 ** Shell Mode
 
 +++
index c7ec228c1dbb851f2d829a5b0f8674805cba4bb2..3d8a4e7edaa71b7e32158a1f87d92e31ec5e0e03 100644 (file)
   "A regexp of names to be disregarded during directory completion."
   :type '(choice regexp (const :tag "None" nil)))
 
+(defcustom pcomplete-remote-file-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 @@ this is `comint-dynamic-complete-functions'."
                            (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-file-ignore)))
+              (non-essential (not (file-remote-p s)))
+              (minibuffer-completing-file-name  (file-remote-p s))))
           (completion-table-with-predicate
            #'comint-completion-file-name-table pred 'strict s p a))))))
 
@@ -1322,7 +1330,8 @@ If specific documentation can't be given, be generic."
   "Sort and remove multiples in SEQUENCE.
 Sequence should be a vector or list of strings."
   (sort (seq-uniq sequence) #'string-lessp))
-(define-obsolete-function-alias 'pcomplete-uniqify-list #'pcomplete-uniquify-list "27.1")
+(define-obsolete-function-alias
+  'pcomplete-uniqify-list #'pcomplete-uniquify-list "27.1")
 
 (defun pcomplete-process-result (cmd &rest args)
   "Call CMD using `call-process' and return the simplest result."
index 7ea9d1c2ead0e6ccaca58abc1f37cc26ee2e692a..b554ee5add95ba4b1b5f2e975dca931f822eb54a 100644 (file)
@@ -595,6 +595,8 @@ Shell buffers.  It implements `shell-completion-execonly' for
   ;; 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-file-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.