Function: python-util-list-files

python-util-list-files is a byte-compiled function defined in python.el.gz.

Signature

(python-util-list-files DIR &optional PREDICATE)

Documentation

List files in DIR, filtering with PREDICATE.

Argument PREDICATE defaults to identity and must be a function that takes one argument (a full path) and returns non-nil for allowed files.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python-util-list-files (dir &optional predicate)
  "List files in DIR, filtering with PREDICATE.
Argument PREDICATE defaults to `identity' and must be a function
that takes one argument (a full path) and returns non-nil for
allowed files."
  (let ((dir-name (file-name-as-directory dir)))
    (apply #'nconc
           (mapcar (lambda (file-name)
                     (let ((full-file-name (expand-file-name file-name dir-name)))
                       (when (and
                              (not (member file-name '("." "..")))
                              (funcall (or predicate #'identity) full-file-name))
                         (list full-file-name))))
                   (directory-files dir-name)))))