unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 12638@debbugs.gnu.org
Subject: bug#12638: 24.2.50; FR: Some suggestions for icomplete-mode
Date: Fri, 30 Nov 2012 11:48:35 +0530	[thread overview]
Message-ID: <87624nsjes.fsf@gmail.com> (raw)
In-Reply-To: <jwvwqx4w0wg.fsf-monnier+bug#12638@gnu.org> (Stefan Monnier's message of "Thu, 29 Nov 2012 16:34:48 -0500")

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


> I've installed part of your changes.  The most glaringly missing part is
> the "highlight first element" feature.

Thanks.  The attached patch should take care of this.

I would also like an option to show candidates in full.  But this after
the attached patch is applied.

,----
| +(defcustom icomplete-hide-common-prefix t
| +  "When non-nil, hide common prefix (if any) from completion candidates.
| +Default setting (typically) allows more candidates to be shown
| +for given `icomplete-prospects-height'.  When nil, show
| +candidates in full."
| +  :type 'boolean
| +  :version "24.3"
| +  :group 'icomplete)
`----


[-- Attachment #2: icomplete-first-match.diff --]
[-- Type: text/x-diff, Size: 2086 bytes --]

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-11-30 04:44:52 +0000
+++ lisp/ChangeLog	2012-11-30 06:08:20 +0000
@@ -1,3 +1,8 @@
+2012-11-30  Jambunathan K  <kjambunathan@gmail.com>
+
+	* icomplete.el (icomplete-first-match): New face.
+	(icomplete-completions): Use it (bug#12638).
+
 2012-11-30  OKAZAKI Tetsurou  <okazaki.tetsurou@gmail.com>  (tiny change)
 
 	* vc/vc.el (vc-register): Allow registering a file which is

=== modified file 'lisp/icomplete.el'
--- lisp/icomplete.el	2012-11-29 21:32:24 +0000
+++ lisp/icomplete.el	2012-11-30 06:01:14 +0000
@@ -76,6 +76,11 @@
   :type 'string
   :version "24.3")
 
+(defface icomplete-first-match  '((t :weight bold))
+  "Face used by icomplete for highlighting the first match."
+  :version "24.3"
+  :group 'icomplete)
+
 ;;;_* User Customization variables
 (defcustom icomplete-prospects-height
   ;; 20 is an estimated common size for the prompt + minibuffer content, to
@@ -377,6 +382,13 @@ are exhibited within the square braces.)
 		     (if (< prospects-len prospects-max)
 			 (push comp prospects)
 		       (setq limit t))))))
+	(setq prospects (nreverse prospects))
+	;; Highlight first of the prospects.
+	(when (and prospects (not most-is-exact))
+	  (let ((first (copy-sequence (pop prospects))))
+	    (put-text-property 0 (length first)
+			       'face 'icomplete-first-match first)
+	    (push first prospects)))
         ;; Restore the base-size info, since completion-all-sorted-completions
         ;; is cached.
         (if last (setcdr last base-size))
@@ -386,8 +398,7 @@ are exhibited within the square braces.)
 		    (and most-is-exact
                          (substring icomplete-separator
                                     (string-match "[^ ]" icomplete-separator)))
-		    (mapconcat 'identity (nreverse prospects)
-                               icomplete-separator)
+		    (mapconcat 'identity prospects icomplete-separator)
 		    (and limit (concat icomplete-separator "…"))
 		    "}")
 	  (concat determ " [Matched]"))))))


  reply	other threads:[~2012-11-30  6:18 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-13 17:33 bug#12638: 24.2.50; FR: Some suggestions for icomplete-mode Jambunathan K
2012-10-13 22:14 ` Stefan Monnier
2012-10-14  4:18 ` Drew Adams
2012-10-23 19:43 ` Stefan Monnier
2012-10-23 20:08   ` Jambunathan K
2012-10-23 20:17     ` Jambunathan K
2012-10-24 13:09     ` Stefan Monnier
2012-11-02 11:49       ` Jambunathan K
2012-11-02 12:12         ` Jambunathan K
2012-11-09  1:53           ` Stefan Monnier
2012-11-09  2:17         ` Stefan Monnier
2012-11-09  4:25           ` Jambunathan K
2012-11-09 14:12             ` Stefan Monnier
2012-11-29 21:34 ` Stefan Monnier
2012-11-30  6:18   ` Jambunathan K [this message]
2012-11-30 19:37     ` Stefan Monnier
2012-12-04 12:54       ` Jambunathan K
2012-12-04 15:02         ` Stefan Monnier
2012-12-04 15:30           ` Jambunathan K
2012-12-04 15:45             ` Stefan Monnier
2012-12-04 16:12               ` Jambunathan K
2012-12-04 17:14                 ` Stefan Monnier
2012-12-04 17:32                   ` Jambunathan K
2012-12-12  3:18                     ` Stefan Monnier
2012-12-12  3:42                       ` Drew Adams
2012-12-12  6:34                         ` Kevin Rodgers
2012-12-12 16:15                           ` Drew Adams
2012-12-04 15:51           ` Jambunathan K
2012-12-13 13:51             ` Jambunathan K
2012-12-17 16:28               ` Stefan Monnier
2012-12-17 19:22                 ` Jambunathan K
2012-12-17 20:12                   ` Stefan Monnier
2012-12-17 20:58                     ` Jambunathan K
2012-12-18  1:26                       ` Stefan Monnier
2012-12-18  3:09                         ` Drew Adams
2012-12-18 14:40                         ` Jambunathan K
2013-01-11  5:47               ` Jambunathan K
2013-01-11 14:17                 ` Stefan Monnier
2013-02-13 13:56                   ` Jambunathan K
2013-02-13 15:15                     ` Stefan Monnier
2013-02-13 17:18                       ` Jambunathan K
2013-11-15  4:42 ` Jambunathan K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87624nsjes.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=12638@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).