2012-05-16 MANPATH

I’m using Emacs on Mac OSX.

Apparently the correct solution for using man and all the related tools is to make sure your /etc/man.conf file is correct. Mine was missing the following line:

MANPATH	/usr/local/man

You can ignore the rest of this page. :)

Thank you, Phil Hudson.

In my ~/.bashrc:

1. there's no MANPATH by default, and manpath(1) just prints /usr/share/man
if [ -z "$MANPATH" ]; then
    export MANPATH=/opt/local/man:/usr/local/man:/usr/local/share/man:/usr/X11R6/man:/usr/share/man

In my ~/.emacs:

;; man
(unless (getenv "MANPATH")
  (setenv "MANPATH"
	    (insert-file-contents-literally "~/.bashrc")
	    (when (re-search-forward "MANPATH=\\(.*\\)" nil t)
	      (match-string 1)))))

And finally my little rebinding of C-h f for Perl mode works for modules as well:

(add-hook 'cperl-mode-hook
	  (lambda ()
	    (local-set-key (kbd "C-h f") 'cperl-perldoc)))

This calls perldoc which in turn calls man which uses MANPATH.



Bizarrely, the Right Thing under OS X since 10.4 is to unset MANPATH. The correct place to declare man path mappings is usrshare/misc/man.conf; scripts and stuff should call ’manpath’ rather than examine $MANPATH. Do `man manpath’ for further info. Emacs should DTRT – I use the MacPorts version.

– PhilHudson 2012-05-16 16:23 UTC

Hm. I hadn’t realized. I think my main problem is that manpath doesn’t list usrlocal/man by default. I need to look at his etcman.conf file… (time passes) Yes, works!


AlexSchroeder 2012-05-16 16:59 UTC

Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.