Function: woman-file-name-all-completions
woman-file-name-all-completions is a byte-compiled function defined in
woman.el.gz.
Signature
(woman-file-name-all-completions TOPIC)
Documentation
Return an alist of the files in all man directories that match TOPIC.
Source Code
;; Defined in /usr/src/emacs/lisp/woman.el.gz
(defun woman-file-name-all-completions (topic)
"Return an alist of the files in all man directories that match TOPIC."
;; Support 3 levels of caching: each element of
;; woman-topic-all-completions is a list of one of the forms:
;; (topic)
;; (topic (path-index) (path-index) ... )
;; (topic (path-index filename) (path-index filename) ... )
;; where there are no duplicates in the value lists.
;; Topic must match first `word' of filename, so ...
(let ((topic-regexp
(concat
"\\`" (regexp-quote topic) ; first `word'
"\\(\\..+\\)*" ; optional subsequent `words'
woman-file-regexp)) ; extension
(topics woman-topic-all-completions)
(path woman-expanded-directory-path)
dir files)
(if (cdr (car topics))
;; Use cached path-info to locate files for each topic:
(let ((path-info (cdr (assoc topic topics)))
filename)
(dolist (elt path-info)
(setq dir (nth (car elt) path)
filename (car (cdr elt))
files (nconc files
;; Find the actual file name:
(if filename
(list (concat dir "/" filename))
(directory-files dir t topic-regexp)
)))))
;; Search path for the files for each topic:
(while path
(setq dir (car path)
path (cdr path))
(if (woman-not-member dir path) ; use each directory only once!
(setq files (nconc files
(directory-files dir t topic-regexp))))))
(mapcar #'list files)))