[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12638: 24.2.50; FR: Some suggestions for icomplete-mode
From: |
Jambunathan K |
Subject: |
bug#12638: 24.2.50; FR: Some suggestions for icomplete-mode |
Date: |
Fri, 30 Nov 2012 11:48:35 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> 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)
`----
=== 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]"))))))