Function: pcomplete--entries

pcomplete--entries is a byte-compiled function defined in pcomplete.el.gz.

Signature

(pcomplete--entries &optional REGEXP PREDICATE)

Documentation

Like pcomplete-entries but without env-var handling.

Source Code

;; Defined in /usr/src/emacs/lisp/pcomplete.el.gz
(defun pcomplete--entries (&optional regexp predicate)
  "Like `pcomplete-entries' but without env-var handling."
  (let* ((ign-pred
          (when (or pcomplete-file-ignore pcomplete-dir-ignore)
            ;; Capture the dynbound value for later use.
            (let ((file-ignore pcomplete-file-ignore)
                  (dir-ignore pcomplete-dir-ignore))
              (lambda (file)
                (not
                 (if (eq (aref file (1- (length file))) ?/)
                     (and dir-ignore (string-match dir-ignore file))
                   (and file-ignore (string-match file-ignore file))))))))
         (reg-pred (if regexp (lambda (file) (string-match regexp file))))
         ;; `completion-file-name-table' calls `file-exists-p' when
         ;; the predicate is nil.
         ;; So likewise, defer to PREDICATE if it's there, else take
         ;; ourselves to be responsible for calling `file-exists-p'.
         (pred (if (or ign-pred reg-pred)
                   (lambda (f)
                     (and (or (null reg-pred)  (funcall reg-pred f))
                          (or (null ign-pred)  (funcall ign-pred f))
                          (funcall (or predicate #'file-exists-p) f)))
                 predicate)))
    (lambda (s p a)
      (if (and (eq a 'metadata) pcomplete-compare-entry-function)
          `(metadata (cycle-sort-function
                      . ,(lambda (comps)
                           (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)
              (tramp-mode (and tramp-mode (not pcomplete-remote-file-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))))))