Function: vc-dir-status-files
vc-dir-status-files is a byte-compiled function defined in vc.el.gz.
Signature
(vc-dir-status-files DIRECTORY &optional FILES BACKEND)
Documentation
Return VC status information about files in DIRECTORY.
Return a list of the form (FILE VC-STATE EXTRA) for each file.
VC-STATE is the current VC state of the file, and EXTRA is optional,
backend-specific information.
Normally files in the up-to-date and ignored states are not
included.
If the optional argument FILES is non-nil, report on only items in
FILES, and don't exclude any for being up-to-date or ignored.
BACKEND is the VC backend; if nil or omitted, it defaults to the result
of calling vc-responsible-backend with DIRECTORY as its first and only
argument.
This function provides Lisp programs with synchronous access to the same
information that Emacs requests from VC backends to populate VC-Dir
buffers. It is usually considerably faster than walking the tree
yourself with a function like vc-file-tree-walk.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
(defun vc-dir-status-files (directory &optional files backend)
"Return VC status information about files in DIRECTORY.
Return a list of the form (FILE VC-STATE EXTRA) for each file.
VC-STATE is the current VC state of the file, and EXTRA is optional,
backend-specific information.
Normally files in the `up-to-date' and `ignored' states are not
included.
If the optional argument FILES is non-nil, report on only items in
FILES, and don't exclude any for being `up-to-date' or `ignored'.
BACKEND is the VC backend; if nil or omitted, it defaults to the result
of calling `vc-responsible-backend' with DIRECTORY as its first and only
argument.
This function provides Lisp programs with synchronous access to the same
information that Emacs requests from VC backends to populate VC-Dir
buffers. It is usually considerably faster than walking the tree
yourself with a function like `vc-file-tree-walk'."
;; The `dir-status-files' API was designed for asynchronous use to
;; populate *vc-dir* buffers; see `vc-dir-refresh'.
;; This function provides Lisp programs with access to the same
;; information without touching the user's *vc-dir* buffers and
;; without having to add a new VC backend function.
;; This function is in this file despite its `vc-dir-' prefix to avoid
;; having to load `vc-dir' just to get access to this simple wrapper.
(let ((morep t) results)
(with-temp-buffer
(setq default-directory directory)
(vc-call-backend (or backend (vc-responsible-backend directory))
'dir-status-files directory files
(lambda (entries &optional more-to-come)
(let (entry)
(while (setq entry (pop entries))
(unless (and (not files)
;; In this case we shouldn't
;; actually get any
;; `up-to-date' or `ignored'
;; entries back, but just in
;; case, filter them.
(memq (cadr entry)
'(up-to-date ignored)))
(push entry results))))
(setq morep more-to-come)))
(while morep (accept-process-output)))
(nreverse results)))