unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Masatake YAMATO <jet@gyve.org>
Cc: larsh@math.ku.dk, emacs-devel@gnu.org
Subject: Re: Emphasize the character to be typed next in *Completions*
Date: Tue, 23 Mar 2004 19:43:06 +0900 (JST)	[thread overview]
Message-ID: <20040323.194306.183038795.jet@gyve.org> (raw)
In-Reply-To: <E1B5cDg-0003DN-IR@fencepost.gnu.org>

>     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

  reply	other threads:[~2004-03-23 10:43 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040322053942.03A2467DC4@imf.math.ku.dk>
2004-03-22  9:31 ` Emphasize the character to be typed next in *Completions* Lars Hansen
2004-03-22  9:48   ` Lars Hansen
2004-03-22  9:55   ` Masatake YAMATO
2004-03-22 11:16     ` Lars Hansen
2004-03-22 11:37       ` David Kastrup
2004-03-22 12:02         ` Lars Hansen
2004-03-23  3:04     ` Richard Stallman
2004-03-23 10:43       ` Masatake YAMATO [this message]
2004-03-23 15:09         ` Kim F. Storm
2004-03-23 15:07           ` Stefan Monnier
2004-03-24  0:07             ` Kim F. Storm
2004-03-24  2:36               ` Masatake YAMATO
2004-03-24  5:53                 ` Miles Bader
2004-03-24 10:38                 ` Kim F. Storm
2004-03-24  5:34         ` Richard Stallman
2004-03-24 10:44           ` Kim F. Storm
2004-03-23 14:29       ` Robert J. Chassell
2004-03-23 18:38         ` Juri Linkov
2004-03-23 21:27           ` Robert J. Chassell
2004-03-25 21:57             ` Juri Linkov
2004-03-23 17:55       ` Juri Linkov
2004-03-23 22:44         ` David Kastrup
2004-03-25 21:31           ` Juri Linkov
2004-03-25  2:00         ` Richard Stallman
2004-03-25 10:04           ` Kim F. Storm
2004-03-27  5:52             ` Richard Stallman
2004-03-27 22:24               ` Stefan Monnier
2004-03-28  4:25                 ` Richard Stallman
2004-03-28 17:35                   ` Stefan Monnier
2004-03-29 20:56                     ` Richard Stallman
2004-03-29 21:24                       ` Stefan Monnier
2004-03-30  5:58                         ` Eli Zaretskii
2004-03-30 11:14                           ` Juri Linkov
2004-03-31  0:50                         ` Richard Stallman
2004-03-31  1:32                           ` Stefan Monnier
2004-03-31 23:02                             ` Miles Bader
     [not found] <20040325063231.137606B7A5@imf.math.ku.dk>
2004-03-25 11:32 ` Lars Hansen
2004-03-25 16:03   ` Masatake YAMATO
2004-04-08 16:30     ` Glenn Morris
2004-04-11 18:12       ` Masatake YAMATO
2004-04-13 17:45         ` Richard Stallman
2004-04-14  3:16           ` Masatake YAMATO
2004-04-15 18:25             ` Juri Linkov
2004-04-16  8:59               ` Masatake YAMATO
2004-03-21 15:13 Masatake YAMATO
2004-03-22  5:25 ` Richard Stallman
2004-03-22 18:29   ` Tak Ota
2004-03-23  0:14   ` Kim F. Storm

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=20040323.194306.183038795.jet@gyve.org \
    --to=jet@gyve.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsh@math.ku.dk \
    /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).