Function: flymake-proc--find-possible-master-files
flymake-proc--find-possible-master-files is a byte-compiled function
defined in flymake-proc.el.gz.
Signature
(flymake-proc--find-possible-master-files FILE-NAME MASTER-FILE-DIRS MASKS)
Documentation
Find (by name and location) all possible master files.
Name is specified by FILE-NAME and location is specified by MASTER-FILE-DIRS. Master files include .cpp and .c for .h. Files are searched for starting from the .h directory and max max-level parent dirs. File contents are not checked.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/flymake-proc.el.gz
(defun flymake-proc--find-possible-master-files (file-name master-file-dirs masks)
"Find (by name and location) all possible master files.
Name is specified by FILE-NAME and location is specified by
MASTER-FILE-DIRS. Master files include .cpp and .c for .h.
Files are searched for starting from the .h directory and max
max-level parent dirs. File contents are not checked."
(let* ((dirs master-file-dirs)
(files nil)
(done nil))
(while (and (not done) dirs)
(let* ((dir (expand-file-name (car dirs) (file-name-directory file-name)))
(masks masks))
(while (and (file-exists-p dir) (not done) masks)
(let* ((mask (car masks))
(dir-files (directory-files dir t mask)))
(flymake-log 3 "dir %s, %d file(s) for mask %s"
dir (length dir-files) mask)
(while (and (not done) dir-files)
(when (not (file-directory-p (car dir-files)))
(setq files (cons (car dir-files) files))
(when (>= (length files) flymake-proc-master-file-count-limit)
(flymake-log 3 "master file count limit (%d) reached" flymake-proc-master-file-count-limit)
(setq done t)))
(setq dir-files (cdr dir-files))))
(setq masks (cdr masks))))
(setq dirs (cdr dirs)))
(when files
(let ((flymake-proc--included-file-name (file-name-nondirectory file-name)))
(setq files (sort files 'flymake-proc--master-file-compare))))
(flymake-log 3 "found %d possible master file(s)" (length files))
files))