unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16226: [patch] icomplete can't display completions on initial display
@ 2013-12-23 15:47 Daniel Colascione
  2013-12-24  3:32 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Colascione @ 2013-12-23 15:47 UTC (permalink / raw)
  To: 16226

[-- Attachment #1: Type: text/plain, Size: 132 bytes --]

This patch allows icomplete to work a bit more like iswitchb and show a 
list of completions when first entering a completion task.

[-- Attachment #2: compl.patch --]
[-- Type: text/x-patch, Size: 2108 bytes --]

=== 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  <dancol@dancol.org>
 
 	* 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  <tzz@lifelogs.com>
 

=== 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))


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-24 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-23 15:47 bug#16226: [patch] icomplete can't display completions on initial display Daniel Colascione
2013-12-24  3:32 ` Stefan Monnier
2013-12-24  3:53   ` Daniel Colascione
2013-12-24 14:45     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).