Function: woman-expand-directory-path

woman-expand-directory-path is a byte-compiled function defined in woman.el.gz.

Signature

(woman-expand-directory-path PATH-DIRS PATH-REGEXPS)

Documentation

Expand the manual directories in PATH-DIRS and PATH-REGEXPS.

PATH-DIRS should be a list of general manual directories (like woman-manpath), while PATH-REGEXPS should be a list of specific manual directory regexps (like woman-path). Ignore any paths that are unreadable or not directories.

Source Code

;; Defined in /usr/src/emacs/lisp/woman.el.gz
(defun woman-expand-directory-path (path-dirs path-regexps)
  "Expand the manual directories in PATH-DIRS and PATH-REGEXPS.
PATH-DIRS should be a list of general manual directories (like
`woman-manpath'), while PATH-REGEXPS should be a list of specific
manual directory regexps (like `woman-path').
Ignore any paths that are unreadable or not directories."
  ;; Allow each path to be a single string or a list of strings:
  (setq path-dirs (ensure-list path-dirs))
  (setq path-regexps (ensure-list path-regexps))
  (let (head dirs path)
    (dolist (dir path-dirs)
      (when (consp dir)
	(unless path
	  (setq path (split-string (getenv "PATH") path-separator t)))
	(setq dir (and (member (car dir) path)
		       (cdr dir))))
      (if (and dir (woman-file-readable-p dir))
	  ;; NB: `parse-colon-path' creates null elements for
	  ;; redundant (semi-)colons and trailing `/'s!
	  ;; If does not actually matter here if dir ends with `/'.
	  ;; Need regexp "man" here to avoid "cat?", `.', `..', etc.
	  (setq dir (woman-canonicalize-dir dir)
		dirs (nconc dirs (directory-files
				  dir t woman-manpath-man-regexp)))))
    (dolist (dir path-regexps)
      (if (or (null dir)
	      (null (setq dir (woman-canonicalize-dir dir)
			  head (file-name-directory dir)))
	      (woman-file-readable-p head))
	  (setq dirs
		(if dir
		    (nconc dirs (woman-directory-files head dir))
		  (cons (directory-file-name default-directory) dirs))
		;; was "." -- at head of list for later filtering
		)))
    (woman-select 'woman-file-accessible-directory-p dirs)))