[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emphasize the character to be typed next in *Completions*
From: |
Masatake YAMATO |
Subject: |
Re: Emphasize the character to be typed next in *Completions* |
Date: |
Tue, 23 Mar 2004 19:43:06 +0900 (JST) |
> Putting bold face on a character has good balance between too much
> highlighting and indistinct representation.
>
> >From my view, Using box face property or underline face property may
> be good...but I have not tried yet.
>
> Should I provide all versions and make them choose-able?
>
> Please implement the ideas that you think might be good to use,
> then try them and see if they are good.
I tried box face property and underline face property, but bold was better
than them. With the attached patch, You can try another face.
cvs diff: warning: unrecognized response `access control disabled, clients can
connect from any host' from cvs server
Index: lisp/simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.633
diff -u -r1.633 simple.el
--- lisp/simple.el 18 Mar 2004 02:57:32 -0000 1.633
+++ lisp/simple.el 23 Mar 2004 10:37:30 -0000
@@ -4117,6 +4117,16 @@
;; This function goes in completion-setup-hook, so that it is called
;; after the text of the completion list buffer is written.
+(defface completion-emphasis
+ '((t (:inherit bold)))
+ "Face used to emphasis the completions in *Completions*.")
+
+
+(defcustom completion-emphasis-region 'first-different-character
+ "Region emphasized in the completions in *Completions*."
+ :type '(choice (const first-different-character)
+ (const common-prefix)))
+
(defun completion-setup-function ()
(save-excursion
(let ((mainbuf (current-buffer))
@@ -4145,6 +4155,26 @@
(save-match-data
(if (minibufferp mainbuf)
(setq completion-base-size 0))))
+ ;; Emphasis the first uncommon character in completions.
+ (if completion-base-size
+ (let ((common-string-length (length
+ (substring mbuf-contents
+ completion-base-size)))
+ (element-start (next-single-property-change (point-min)
'mouse-face))
+ element-common-end)
+ (while element-start
+ (setq element-common-end (+ element-start common-string-length))
+ (when (and (get-char-property element-start 'mouse-face)
+ (get-char-property element-common-end 'mouse-face))
+ (case completion-emphasis-region
+ (common-prefix
+ (put-text-property element-start element-common-end
+ 'font-lock-face 'completion-emphasis))
+ (first-different-character
+ (put-text-property element-common-end (1+ element-common-end)
+ 'font-lock-face 'completion-emphasis))))
+ (setq element-start (next-single-property-change element-start
'mouse-face)))))
+ ;; Insert help string.
(goto-char (point-min))
(if (display-mouse-p)
(insert (substitute-command-keys
- Re: Emphasize the character to be typed next in *Completions*, (continued)
- Re: Emphasize the character to be typed next in *Completions*, Richard Stallman, 2004/03/22
- Re: Emphasize the character to be typed next in *Completions*, Lars Hansen, 2004/03/22
- Re: Emphasize the character to be typed next in *Completions*, Richard Stallman, 2004/03/22
- Re: Emphasize the character to be typed next in *Completions*,
Masatake YAMATO <=
- Re: Emphasize the character to be typed next in *Completions*, Kim F. Storm, 2004/03/23
- Re: Emphasize the character to be typed next in *Completions*, Stefan Monnier, 2004/03/23
- Re: Emphasize the character to be typed next in *Completions*, Kim F. Storm, 2004/03/23
- Re: Emphasize the character to be typed next in *Completions*, Masatake YAMATO, 2004/03/23
- Re: Emphasize the character to be typed next in *Completions*, Miles Bader, 2004/03/24
- Re: Emphasize the character to be typed next in *Completions*, Kim F. Storm, 2004/03/24
- Re: Emphasize the character to be typed next in *Completions*, Richard Stallman, 2004/03/24
- Re: Emphasize the character to be typed next in *Completions*, Kim F. Storm, 2004/03/24
- Re: Emphasize the character to be typed next in *Completions*, Robert J. Chassell, 2004/03/23
- Re: Emphasize the character to be typed next in *Completions*, Juri Linkov, 2004/03/23