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

From: Drew Adams <[email-masked]>
Date: Sat, 15 Feb 2014 19:04:56 -0800 (PST)

> Since `man -k ls' doesn't give a summary for the `ls' man page I
> think that
> 
> >> (1) `man -k' can't find any whatis database or all those files
> >> are empty.
> 
> At least it doesn't have an entry for ls.  You should be able to
> create this file by running the `makewhatis' command.

Maybe so, and good to know; thanks.  But a priori I don't want to
have to do that.

IIRC, I used to, with an older version of Cygwin, have `M-x man'
provide completion without having to do anything at all.

> >> > Thereafter I can do nothing with that.  Whether I type
> >> > anything after the `^:' or not, TAB just completes to `^:'.
> >>
> >> I think that has been fixed as a by-product of a 2013-01-10
> >> change:	(man): Flush the completion cache between uses.
> >
> > Not sure what you mean, but the behavior is not fixed for me.
> > I still get exactly the same behavior I reported, even with
> > Emacs builds from only a few days ago.
> 
> IIUC, you had the following in mind:
> 
> M-x man RET TAB C-g M-x man RET l TAB

Not necessarily.  Why `C-g'?  If the first TAB shows all
completions then I might just type `l TAB' to narrow that down.

But this is a detail.  Sure, what you wrote is something I would
also expect to work.  You didn't say what you expect to happen
after the first TAB, but if it is to show all possible
completions then yes.

> used to give `^:' (because the cache of man page name completions
> was not flushed between invocations of man).
> 
> If you set Man-man-k-use-anchor to t it should give [No match] now.

No, it does not.  I did this:

M-x man C-g  ; Load library man, since `Man-man-k-use-anchor'
             ; is not yet defined (this step not really needed)

M-: (setq Man-man-k-use-anchor t)

M-x man RET TAB  ; Shows ^: as the sole completion.

It does not say [No match].  Did I understand you correctly that
you thought it would, or am I missing something?

AFAICT, the value of `Man-man-k-use-anchor' makes no difference.
If setting that to non-nil solved the problem then things would
be fine.  I have no problem setting another variable in my setup.

(FWIW: Why isn't this variable a user option?)

> > that is still the behavior I see: there is no completion for
> > `M-x man'.
> 
> As explained above the source for the completions is the `whatis'
> file at a man root directory.

Isn't it possible to have `M-x man' provide completion without
users having to use `makewhatis'?  I think that was the case
in the past.  Or if it is necessary (for Cygwin), then why not
have Emacs do that when necessary (upon user confirmation)?

Why should an Emacs user have to know about this at all, and
invoke such a shell command directly?