Subject: bug#13160: 24.3.50; [PATCH] man page completion support beyond man-db

From: Stefan Monnier <[email-masked]>
Date: Sat, 22 Dec 2012 12:11:44 -0500

>>>> It's not used for parsing, it's only prepended to the search string
>>>> passed to `man -k'.
>>> Ah.  I even had a note in my bit about that.  Yes.  Daniel Pittman I
>>> think it was reported that on macos man -k '' empty string gives no
>>> output, hence "^".
>> Right, the empty string deserves special attention, also because it has
>> the potential to mess up the cache.  Thanks for reminding me of this.
> Actually, I think the cache is really the clue here: prepending
> completions piecemeal to the cache makes only sense if the user
> consciously avoids completing the empty string because of memory
> constraints... and even then the cache would have to be a trie or
> something to be useful.

I don't consciously avoid it, but I just never hit TAB to complete
a manpage name without first typing a few chars.  I doubt I'm the
only one.

On  my system "make -k ^" returns about 9K commands of average length
14chars, so that's about 9K * (16B (chars) + 16B (string object) + 2*8B
(cons cells)) or more than 400KB (on a 32bit system) or 700KB (on
a 64bit system) for that cache.  I'm not sure it's such a good idea.

Does it fix an actual bug? [ Sorry if it does fix a real bug and this
was mentioned somewhere in this thread, but I haven't found the time to
read all threads as thoroughly as I'd like.  ]

> 	Support man page completion for more man programs.  (Bug#13160)
> 	* man.el (Man-parse-apropos): New function.
> 	(Man-completion-table): Use it in parsing `man -k' output to
> 	replace code peculiar to man-db.
> 	Thanks to Kevin Ryde for commenting on a previous version of this.

This part of the patch looks OK, feel free to install it.

>       * automated/man-tests.el: New file.

And that as well, of course.

        Stefan