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

* bug#16226: [patch] icomplete can't display completions on initial display
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2013-12-24  3:32 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: 16226

> +(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)

The ":group 'icomplete" is redundant (I know it's there in the other
defcustoms, and yes, it's also redundant there).

> +      (if (and (or (> (icomplete--field-end) (icomplete--field-beg))
> +                   (and icomplete-show-matches-on-no-input
> +                        (= (icomplete--field-end) (icomplete--field-beg))))

The (= (icomplete--field-end) (icomplete--field-beg)) condition is
redundant as well.  Other than that, please install it.


        Stefan





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

* bug#16226: [patch] icomplete can't display completions on initial display
  2013-12-24  3:32 ` Stefan Monnier
@ 2013-12-24  3:53   ` Daniel Colascione
  2013-12-24 14:45     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Colascione @ 2013-12-24  3:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16226

On 12/23/2013 07:32 PM, Stefan Monnier wrote:
> The (= (icomplete--field-end) (icomplete--field-beg)) condition is
> redundant as well.  Other than that, please install it.

Done. Thanks.

The next problem for me is the obnoxious prompt: when icomplete is 
enabled, the default choice is readily apparent. switch-to-buffer, 
however, still enthusiastically displays the "default" choice in the 
prompt, and this hint becomes stale once we start cycling through 
completions. Right now, I'm using minibuf-eldef to kill that part of the 
prompt, but there must be a better way. Would you be opposed to a C 
level variable that stopped completions functions from adding the 
default choice bit to the prompt in the first place?





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

* bug#16226: [patch] icomplete can't display completions on initial display
  2013-12-24  3:53   ` Daniel Colascione
@ 2013-12-24 14:45     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-12-24 14:45 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: 16226

> The next problem for me is the obnoxious prompt: when icomplete is enabled,
> the default choice is readily apparent. switch-to-buffer, however, still
> enthusiastically displays the "default" choice in the prompt, and this hint
> becomes stale once we start cycling through completions. Right now, I'm
> using minibuf-eldef to kill that part of the prompt, but there must
> be a better way.

I think minibuf-eldef is the way to go, yes.

> Would you be opposed to a C level variable that stopped completions
> functions from adding the default choice bit to the prompt in the
> first place?

That wouldn't work, since the default is added "by hand" at
tens/hundreds of places.


        Stefan





^ 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).