unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Emphasize the character to be typed next in *Completions*
@ 2004-03-21 15:13 Masatake YAMATO
  2004-03-22  5:25 ` Richard Stallman
  0 siblings, 1 reply; 48+ messages in thread
From: Masatake YAMATO @ 2004-03-21 15:13 UTC (permalink / raw)


This patch improves visual feedback of *Completions* buffer. So 
the user can know the character to be typed next in mini buffer
more easily.

Consider you type "C-x C-f ChangeLog. tab tab" at emacs/lisp directory.
The minibuffer looks like:

    Find file: ~/hack/emacs/lisp/ChangeLog

and *Completions* buffer looks like:

    Click <mouse-2> on a completion to select it.
    In this buffer, type RET to select the completion near point.

    Possible completions are:
    ChangeLog.1                    ChangeLog.10
    ChangeLog.2                    ChangeLog.3
    ChangeLog.4                    ChangeLog.5
    ChangeLog.6                    ChangeLog.7
    ChangeLog.8                    ChangeLog.9

You will look into *Completions* buffer to find the file
name which you want to load into emacs.

My patch make the first different character in all completions
bold. In above example, characters marked by ^ is made bold.

    ChangeLog.1                    ChangeLog.10
              ^                              ^
    ChangeLog.2                    ChangeLog.3
              ^                              ^
    ChangeLog.4                    ChangeLog.5
              ^                              ^
    ChangeLog.6                    ChangeLog.7
              ^                              ^
    ChangeLog.8                    ChangeLog.9
              ^                              ^
So the user can know which key should be typed to choose
a completion easily.

Masatake YAMATO

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	21 Mar 2004 14:53:54 -0000
@@ -4145,6 +4145,19 @@
 	(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-start)
+	    (while element-start
+	      (setq element-common-start (+ element-start common-string-length))
+	      (when (and (get-char-property element-start 'mouse-face)
+			 (get-char-property element-common-start 'mouse-face))
+		(put-text-property element-common-start (+ element-common-start 1) 'face 'bold))
+	      (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

^ permalink raw reply	[flat|nested] 48+ messages in thread
[parent not found: <20040322053942.03A2467DC4@imf.math.ku.dk>]
[parent not found: <20040325063231.137606B7A5@imf.math.ku.dk>]

end of thread, other threads:[~2004-04-16  8:59 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-21 15:13 Emphasize the character to be typed next in *Completions* Masatake YAMATO
2004-03-22  5:25 ` Richard Stallman
2004-03-22 18:29   ` Tak Ota
2004-03-23  0:14   ` Kim F. Storm
     [not found] <20040322053942.03A2467DC4@imf.math.ku.dk>
2004-03-22  9:31 ` 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
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

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