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

From: Wolfgang Jenkner <[email-masked]>
Date: Sun, 06 Jan 2013 20:27:56 +0100

On Mon, Dec 24 2012, Stefan Monnier wrote:

> The fact that the cache is preserved between runs of M-x man is
> probably more a misfeature, since it means that the cache is never
> refreshed (i.e. gets out of date after "aptitude upgrade").

Given that and the fact that indefinitely keeping around large lists
(like Man-completion-cache holding the completion of an empty prefix) is
bad, why not preventing this (the first hunk is the fix you proposed in
http://permalink.gmane.org/gmane.emacs.bugs/68945).

Wolfgang

-- >8 --
Subject: [PATCH] * lisp/man.el (Man-completion-table): Reset cache to nil.
 (man): Bind Man-completion-cache to nil, thus clarifying that it is not meant
 to be persistent.  (Bug#13160)

---
 lisp/man.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/man.el b/lisp/man.el
index 847917d8..8210d63 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -815,6 +815,7 @@ POS defaults to `point'."
               (call-process manual-program nil '(t nil) nil
                             "-k" (concat "^" prefix))))
           (goto-char (point-min))
+          (setq table nil)
           (while (re-search-forward "^\\([^ \t\n]+\\)\\(?: ?\\((.+?)\\)\\(?:[ \t]+- \\(.*\\)\\)?\\)?" nil t)
             (push (propertize (concat (match-string 1) (match-string 2))
                               'help-echo (match-string 3))
@@ -891,6 +892,7 @@ names or descriptions.  The pattern argument is usually an
 		;; ("man -k" is case-insensitive similarly, so the
 		;; table has everything available to complete)
 		(completion-ignore-case t)
+		Man-completion-cache
 		(input (completing-read
 			(format "Manual entry%s"
 				(if (string= default-entry "")
-- 
1.8.0.2