Subject: bug#16226: [patch] icomplete can't display completions on initial display

From: Daniel Colascione <[email-masked]>
Date: Mon, 23 Dec 2013 07:47:09 -0800

This patch allows icomplete to work a bit more like iswitchb and show a 
list of completions when first entering a completion task.
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2013-12-23 15:01:32 +0000
+++ lisp/ChangeLog	2013-12-23 15:42:53 +0000
@@ -1,6 +1,11 @@
 2013-12-23  Daniel Colascione  <[email-masked]>
 
 	* icomplete.el: Move `provide' to end of file.
+	(icomplete-show-matches-on-no-input): New customizable variable.
+	(icomplete-minibuffer-setup): Call `icomplete-exhibit' on setup if
+	we have something to show.
+	(icomplete-exhibit): Compute completions even if we have no user
+	input.
 
 2013-12-23  Teodor Zlatanov  <[email-masked]>

=== modified file 'lisp/icomplete.el'
--- lisp/icomplete.el	2013-12-23 15:01:32 +0000
+++ lisp/icomplete.el	2013-12-23 15:32:57 +0000
@@ -79,6 +79,12 @@
   :version "24.4"
   :group 'icomplete)
 
+(defcustom icomplete-show-matches-on-no-input t
+  "When non-nil, show completions when first prompting for input."
+  :type 'boolean
+  :version "24.4"
+  :group 'icomplete)
+
 (defface icomplete-first-match  '((t :weight bold))
   "Face used by icomplete for highlighting first match."
   :version "24.4"
@@ -256,7 +262,9 @@
     					 (current-local-map)))
     (add-hook 'pre-command-hook  #'icomplete-pre-command-hook  nil t)
     (add-hook 'post-command-hook #'icomplete-post-command-hook nil t)
-    (run-hooks 'icomplete-minibuffer-setup-hook)))
+    (run-hooks 'icomplete-minibuffer-setup-hook)
+    (when icomplete-show-matches-on-no-input
+      (icomplete-exhibit))))
 
 (defvar icomplete--in-region-buffer nil)
 
@@ -304,8 +312,9 @@
     (save-excursion
       (goto-char (point-max))
                                         ; Insert the match-status information:
-      (if (and (> (icomplete--field-end) (icomplete--field-beg))
-               buffer-undo-list         ; Wait for some user input.
+      (if (and (or (> (icomplete--field-end) (icomplete--field-beg))
+                   (and icomplete-show-matches-on-no-input
+                        (= (icomplete--field-end) (icomplete--field-beg))))
                (or
                 ;; Don't bother with delay after certain number of chars:
                 (> (- (point) (icomplete--field-beg))