Subject: Re: bug#16722: 24.3.50; `M-x man' does not handle case appropriately

From: Eli Zaretskii <[email-masked]>
Date: Sun, 16 Feb 2014 05:50:51 +0200

> From: Wolfgang Jenkner <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 16 Feb 2014 02:08:32 +0100
> 
> On Sat, Feb 15 2014, Eli Zaretskii wrote:
> 
> >> It seems (http://cygwin.com/packages/) that man-1.* is the man package
> >> provided by default in cygwin, but I suppose cygwin packages could also
> >> be used with a non-cygwin emacs?  Would it be reasonable to set the
> >> default for `Man-man-k-use-anchor' to non-nil if the system type is
> >> `cygwin' or `windows-nt' or `ms-dos'?
> >
> > It is much better, IMO, to probe for "man -k" support the first time
> > "M-x man" is invoked, like we do with "M-x grep".  Relying on
> > system-type should only be a very distant second candidate (e.g., what
> > if Windows machines will get a proper 'man' command that does supports
> > apropos databases?).
> 
> But `man -k' always works (to the extent we need it to) if the whatis
> database is correctly installed.

No, it doesn't.  For example, it isn't supported with this clone:

  http://sourceforge.net/projects/ezwinports/files/man-1.4-bin.zip/download

And, as demonstrated in this bug report, it can backfire when the
database is not "correctly installed".

My suggestion will gracefully handle both cases.

> The problem is just a bug in this particular implementation, viz.,
> `man -k' sends error messages to stdout.  Strictly speaking, POSIX
> requires emacs to assume that everything in stdout represents content
> from the whatis database, but this is not desirable in this case.
> Setting `Man-man-k-use-anchor' to non-nil works around this annoyance,
> for the reasons I explained in this bug thread.

If you are saying that users should set an option to avoid this
problem, I might agree (although I don't think this option will help
for the above clone).  However, having Emacs detect this automatically
is even better.