Subject: bug#5578: 23.1.92; M-x man should consider $MANPATH when making completions

From: Colin Watson <[email-masked]>
Date: Mon, 15 Feb 2010 08:41:26 +0000

On Sun, Feb 14, 2010 at 11:30:10AM -0500, Stefan Monnier wrote:
> > $ man -w whoami
> > /usr/share/man/man1/whoami.1.gz
> > $ man -k whoami
> > whoami (1)           - print effective userid
> > $ man -w sa-update
> > /home/jidanni/.spamassassin-tree/man/man1/sa-update.1p
> > $ man -k sa-update
> > $
> 
> Looks like a bug/misfeature in the `man' program, then.
> Of course, man.el could try to work around this limitation, but I think
> we first should try to get it fixed.

(Hi, maintainer of man-db speaking here.)

In some ways it is not ideal that people have to run 'mandb' by hand
before 'man -k' and similar tools work.  (I believe that the other
commonly-used implementation works similarly, except that the program
you have to run is called 'makewhatis'.)

On the other hand, some years ago (up to man-db 2.3.19, 2001 or
thereabouts) man used to build its databases on the fly and the results
were generally regarded as disastrous: they tended to involve lots of
waiting around for interactive queries to return while the database was
rebuilt.  Everyone hated it.  I deliberately changed this, and I'm not
keen to return to the previous situation as I remember what it was like.

On balance, I think I prefer the current state of the trade-off.

I don't know that it's appropriate for Emacs to work around this; it
clearly has some entitlement to assume that 'man -k' works.  (On Debian
and allied systems, system manual pages always work fine as the
packaging system nowadays takes care to run mandb whenever necessary;
this only affects user manual pages, which are relatively rare.)
Perhaps 'man -k' ought to print a message on stderr in some
circumstances telling you to run mandb, although unfortunately much of
the time working out that you need to run mandb involves a substantial
part of the work involved in actually running mandb, so I'm not sure
whether this would be a good idea ...

Regards,

-- 
Colin Watson                                       [[email-masked]]