Function: tramp-completion-handle-file-directory-p
tramp-completion-handle-file-directory-p is a byte-compiled function
defined in tramp.el.gz.
Signature
(tramp-completion-handle-file-directory-p FILENAME)
Documentation
Like file-directory-p for partial Tramp files.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
;; This is needed in pcomplete.el.
(defun tramp-completion-handle-file-directory-p (filename)
"Like `file-directory-p' for partial Tramp files."
;; We need special handling only when a method is needed. Then we
;; regard all files "/method:" or "/[method/" as existent, if
;; "method" is a valid Tramp method.
(or (and (cond
;; Completion styles like `flex' and `substring' check for
;; the file name "/". This does exist.
((string-equal filename "/"))
;; Is it a valid method?
((and (not (string-empty-p tramp-postfix-method-format))
(string-match
(rx
(regexp tramp-prefix-regexp)
(* (regexp tramp-remote-file-name-spec-regexp)
(regexp tramp-postfix-hop-regexp))
(group-n 9 (regexp tramp-method-regexp))
(| (regexp tramp-postfix-method-regexp) eos))
filename))
(assoc (match-string 9 filename) tramp-methods))
;; Is it a completion file name?
((string-match-p tramp-completion-file-name-regexp filename)))
t)
(tramp-run-real-handler #'file-directory-p (list filename))))