Function: woman-topic-all-completions-1
woman-topic-all-completions-1 is a byte-compiled function defined in
woman.el.gz.
Signature
(woman-topic-all-completions-1 DIR PATH-INDEX)
Documentation
Return an alist of the man topics in directory DIR with index PATH-INDEX.
A topic is a filename sans type-related extensions.
Support 3 levels of caching: each element of the alist will be a list
of the first woman-cache-level elements from the following list:
(topic path-index filename).
Source Code
;; Defined in /usr/src/emacs/lisp/woman.el.gz
(defun woman-topic-all-completions-1 (dir path-index)
"Return an alist of the man topics in directory DIR with index PATH-INDEX.
A topic is a filename sans type-related extensions.
Support 3 levels of caching: each element of the alist will be a list
of the first `woman-cache-level' elements from the following list:
\(topic path-index filename)."
;; This function used to check that each file in the directory was
;; not itself a directory, but this is very slow and should be
;; unnecessary. So let us assume that `woman-file-regexp' will
;; filter out any directories, which probably should not be there
;; anyway, i.e. it is a user error!
;;
;; Don't sort files: we do that when merging, anyway. -- dak
(let (newlst (lst (directory-files dir nil woman-file-regexp t))
;; Make an explicit regexp for stripping extension and
;; compression extension: file-name-sans-extension is a
;; far too costly function. -- dak
(ext (format "\\(\\.[^.\\/]*\\)?\\(%s\\)?\\'"
woman-file-compression-regexp)))
;; Use a loop instead of mapcar in order to avoid the speed
;; penalty of binding function arguments. -- dak
(dolist (file lst newlst)
(push
(cons
(if (string-match ext file)
(substring file 0 (match-beginning 0))
file)
(and (> woman-cache-level 1)
(cons
path-index
(and (> woman-cache-level 2)
(list file)))))
newlst))))