Function: woman-parse-man.conf
woman-parse-man.conf is a byte-compiled function defined in
woman.el.gz.
Signature
(woman-parse-man.conf)
Documentation
Parse if possible configuration file for man command.
Used only if MANPATH is not set or contains null components.
Look in woman-man.conf-path and return a value for woman-manpath.
Concatenate data from all lines in the config file of the form
MANPATH /usr/man
or
MANDATORY_MANPATH /usr/man
or
OPTIONAL_MANPATH /usr/man
or
MANPATH_MAP /opt/bin /opt/man
Source Code
;; Defined in /usr/src/emacs/lisp/woman.el.gz
(defun woman-parse-man.conf ()
"Parse if possible configuration file for man command.
Used only if MANPATH is not set or contains null components.
Look in `woman-man.conf-path' and return a value for `woman-manpath'.
Concatenate data from all lines in the config file of the form
MANPATH /usr/man
or
MANDATORY_MANPATH /usr/man
or
OPTIONAL_MANPATH /usr/man
or
MANPATH_MAP /opt/bin /opt/man"
;; Functionality suggested by Charles Curley.
(let ((path woman-man.conf-path)
file manpath)
(while (and
path
(not (and
(file-readable-p (setq file (car path)))
;; If not a file then find the file:
(or (not (file-directory-p file))
(and
(setq file
(directory-files file t "\\`man.*\\.conf[a-z]*\\'" t))
(file-readable-p (setq file (car file)))))
;; Parse the file -- if no MANPATH data ignore it:
(with-temp-buffer
(insert-file-contents file)
(while (re-search-forward
;; `\(?: ... \)' is a "shy group"
"\
^[ \t]*\\(?:\\(?:MANDATORY_\\|OPTIONAL_\\)?MANPATH[ \t]+\\(\\S-+\\)\\|\
MANPATH_MAP[ \t]+\\(\\S-+\\)[ \t]+\\(\\S-+\\)\\)" nil t)
(cl-pushnew (if (match-beginning 1)
(match-string 1)
(cons (match-string 2)
(match-string 3)))
manpath :test #'equal))
manpath))
))
(setq path (cdr path)))
(nreverse manpath)))