Subject: Re: bug#12861: wrong default value when completing in woman-file-name

From: Stefan Monnier <[email-masked]>
Date: Sun, 11 Nov 2012 10:54:53 -0500

> Could you please change this so that the key sequence actually used to
> invoke `minibuffer-complete' is unread instead of TAB (or just call
> `minibuffer-complete' explicitly?).

Unreading events is nasty business.  Sometimes it's hard to avoid, but
I don't think it's justified here, indeed.  The patch below should fix
your problem, but could you confirm it provides the intended
completion behavior?

        Stefan

=== modified file 'lisp/woman.el'
--- lisp/woman.el	2012-10-29 10:30:11 +0000
+++ lisp/woman.el	2012-11-11 15:54:23 +0000
@@ -1303,12 +1303,11 @@
        ((null (cdr files)) (car (car files))) ; only 1 file for topic.
        (t
 	;; Multiple files for topic, so must select 1.
-	;; Unread the command event (TAB = ?\t = 9) that runs the command
-	;; `minibuffer-complete' in order to automatically complete the
-	;; minibuffer contents as far as possible.
-	(setq unread-command-events '(9)) ; and delete any type-ahead!
+	;; Run the command `minibuffer-complete' in order to automatically
+	;; complete the minibuffer contents as far as possible.
+        (minibuffer-with-setup-hook #'minibuffer-complete
 	(completing-read "Manual file: " files nil 1
-			 (try-completion "" files) 'woman-file-history))))))
+                           (try-completion "" files) 'woman-file-history)))))))
 
 (defun woman-select (predicate list)
   "Select unique elements for which PREDICATE is true in LIST.