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. MANPATH
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
fi

In my ~/.emacs:

;; man
(unless (getenv "MANPATH")
  (setenv "MANPATH"
	  (with-temp-buffer
	    (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`.

​#Emacs

Comments

(Please contact me if you want to remove your comment.)

Bizarrely, the Right Thing under OS X since 10.4 is to *unset* MANPATH. The correct place to declare man path mappings is _usr_share/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.

MacPorts

– PhilHudson 2012-05-16 16:23 UTC

---

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

Thanks.

– Alex Schroeder 2012-05-16 16:59 UTC

Alex Schroeder