Function: Man-header-file-path

Man-header-file-path is a byte-compiled function defined in man.el.gz.

Signature

(Man-header-file-path)

Documentation

Return the C header file search path that Man should use.

Normally, this is the value of the user option Man-header-file-path(var)/Man-header-file-path(fun), but when the man page is formatted on a remote system (see Man-support-remote-systems), this function tries to figure out the list of directories where the remote system has the C header files.

Source Code

;; Defined in /usr/src/emacs/lisp/man.el.gz
(defun Man-header-file-path ()
  "Return the C header file search path that Man should use.
Normally, this is the value of the user option `Man-header-file-path',
but when the man page is formatted on a remote system (see
`Man-support-remote-systems'), this function tries to figure out the
list of directories where the remote system has the C header files."
  (let ((remote-id (file-remote-p default-directory)))
    (if (null remote-id)
        ;; The local case.
        (if (not (eq t Man-header-file-path))
            Man-header-file-path
          (require 'ffap)
          (defvar ffap-c-path)
          ffap-c-path)
      ;; The remote case.  Use connection-local variables.
      (mapcar
       (lambda (elt) (concat remote-id elt))
       (with-connection-local-variables
        (or (and (local-variable-p 'Man-header-file-path (current-buffer))
                 Man-header-file-path)
            (setq-connection-local
             Man-header-file-path
             (let ((arch (with-temp-buffer
                           (when (zerop (ignore-errors
                                          (process-file "gcc" nil '(t nil) nil
                                                        "-print-multiarch")))
                             (goto-char (point-min))
                             (buffer-substring (point) (line-end-position)))))
                   (base '("/usr/include" "/usr/local/include")))
               (if (zerop (length arch))
                   base
                 (append
                  base (list (expand-file-name arch "/usr/include"))))))))))))