Function: Man-support-local-filenames

Man-support-local-filenames is a byte-compiled function defined in man.el.gz.

Signature

(Man-support-local-filenames)

Documentation

Return non-nil if the man command supports local filenames.

Different man programs support this feature in different ways. The default Debian man program ("man-db") has a --local-file
(or -l) option for this purpose. The default Red Hat man
program has no such option, but interprets any name containing a "/" as a local filename. The function returns either man-db man, or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/man.el.gz
(defun Man-support-local-filenames ()
  "Return non-nil if the man command supports local filenames.
Different man programs support this feature in different ways.
The default Debian man program (\"man-db\") has a `--local-file'
\(or `-l') option for this purpose.  The default Red Hat man
program has no such option, but interprets any name containing
a \"/\" as a local filename.  The function returns either `man-db'
`man', or nil."
  (if (eq Man-support-local-filenames 'auto-detect)
      (setq Man-support-local-filenames
            (with-temp-buffer
              (let ((default-directory
                      ;; Ensure that `default-directory' exists and is readable.
                      (if (file-accessible-directory-p default-directory)
                          default-directory
                        (expand-file-name "~/"))))
                (ignore-errors
                  (call-process manual-program nil t nil "--help")))
              (cond ((search-backward "--local-file" nil 'move)
                     'man-db)
                    ;; This feature seems to be present in at least ver 1.4f,
                    ;; which is about 20 years old.
                    ;; I don't know if this version has an official name?
                    ((looking-at "^man, versione? [1-9]")
                     'man))))
    Man-support-local-filenames))