aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasatake YAMATO2004-03-25 16:01:38 +0000
committerMasatake YAMATO2004-03-25 16:01:38 +0000
commitabcdd45aee4b2d927833de14bb9e3708ea378927 (patch)
tree5a477ffbf5f5926a4b40b1bffd757ba6d712a8b7
parent5217a76a0ba390795450b1bef08672202c9d9f4e (diff)
downloademacs-abcdd45aee4b2d927833de14bb9e3708ea378927.tar.gz
emacs-abcdd45aee4b2d927833de14bb9e3708ea378927.zip
(completion-setup-function): Emphasize the first uncommon characters in the completions;and de-emphasize the common prefix substrings.
(completion-emphasis): New face. (completion-de-emphasis): New face.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/simple.el30
2 files changed, 38 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f9597cdbe4d..89a18361ddd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12004-03-26 Masatake YAMATO <jet@gyve.org>
2
3 * simple.el (completion-setup-function): Emphasize the
4 first uncommon characters in the completions;and de-emphasize
5 the common prefix substrings.
6 (completion-emphasis): New face.
7 (completion-de-emphasis): New face.
8
12004-03-25 Sam Steingold <sds@gnu.org> 92004-03-25 Sam Steingold <sds@gnu.org>
2 10
3 * vc.el (vc-print-log): Fixed a bug in the last patch: 11 * vc.el (vc-print-log): Fixed a bug in the last patch:
diff --git a/lisp/simple.el b/lisp/simple.el
index f41b9cbd11a..6bc89ae1750 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4116,6 +4116,15 @@ The completion list buffer is available as the value of `standard-output'.")
4116 4116
4117;; This function goes in completion-setup-hook, so that it is called 4117;; This function goes in completion-setup-hook, so that it is called
4118;; after the text of the completion list buffer is written. 4118;; after the text of the completion list buffer is written.
4119(defface completion-emphasis
4120 '((t (:inherit bold)))
4121 "Face put on the first uncommon character in completions in *Completions* buffer."
4122 :group 'completion)
4123
4124(defface completion-de-emphasis
4125 '((t (:inherit default)))
4126 "Face put on the common prefix substring in completions in *Completions* buffer."
4127 :group 'completion)
4119 4128
4120(defun completion-setup-function () 4129(defun completion-setup-function ()
4121 (save-excursion 4130 (save-excursion
@@ -4145,6 +4154,27 @@ The completion list buffer is available as the value of `standard-output'.")
4145 (save-match-data 4154 (save-match-data
4146 (if (minibufferp mainbuf) 4155 (if (minibufferp mainbuf)
4147 (setq completion-base-size 0)))) 4156 (setq completion-base-size 0))))
4157 ;; Put emphasis and de-emphasis faces on completions.
4158 (when completion-base-size
4159 (let ((common-string-length (length
4160 (substring mbuf-contents
4161 completion-base-size)))
4162 (element-start (next-single-property-change
4163 (point-min)
4164 'mouse-face))
4165 element-common-end)
4166 (while element-start
4167 (setq element-common-end (+ element-start common-string-length))
4168 (when (and (get-char-property element-start 'mouse-face)
4169 (get-char-property element-common-end 'mouse-face))
4170 (put-text-property element-start element-common-end
4171 'font-lock-face 'completion-de-emphasis)
4172 (put-text-property element-common-end (1+ element-common-end)
4173 'font-lock-face 'completion-emphasis))
4174 (setq element-start (next-single-property-change
4175 element-start
4176 'mouse-face)))))
4177 ;; Insert help string.
4148 (goto-char (point-min)) 4178 (goto-char (point-min))
4149 (if (display-mouse-p) 4179 (if (display-mouse-p)
4150 (insert (substitute-command-keys 4180 (insert (substitute-command-keys