Function: project-combine-directories
project-combine-directories is a byte-compiled function defined in
project.el.gz.
Signature
(project-combine-directories &rest LISTS-OF-DIRS)
Documentation
Return a sorted and culled list of directory names.
Appends the elements of LISTS-OF-DIRS together, removes non-existing directories, as well as directories a parent of whose is already in the list.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/project.el.gz
(defun project-combine-directories (&rest lists-of-dirs)
"Return a sorted and culled list of directory names.
Appends the elements of LISTS-OF-DIRS together, removes
non-existing directories, as well as directories a parent of
whose is already in the list."
(let* ((dirs (sort
(mapcar
(lambda (dir)
(file-name-as-directory (expand-file-name dir)))
(apply #'append lists-of-dirs))
#'string<))
(ref dirs))
;; Delete subdirectories from the list.
(while (cdr ref)
(if (string-prefix-p (car ref) (cadr ref))
(setcdr ref (cddr ref))
(setq ref (cdr ref))))
(cl-delete-if-not #'file-exists-p dirs)))