From: Masatake YAMATO <jet@gyve.org>
Subject: Enhanced enhanced visual feedback in `*Completions*' buffer
Date: Sat, 08 Oct 2005 16:02:07 +0900 (JST) [thread overview]
Message-ID: <20051008.160207.188502984.jet@gyve.org> (raw)
Hi,
"Enhanced visual feedback in `*Completions*' buffer" was supported
completion performed in minibuffer only. Attached patch generalizes
the function; it supports completion performed outside of minibuffer.
I introduce a variable, `completion-common-string' which is used as a
hint in `completion-setup-function' to put faces to *Completions*
buffer. Client code like `lisp-complete-symbol' sets
`completion-common-string'.
Masatake YAMATO
2005-10-08 Masatake YAMATO <jet@gyve.org>
* simple.el (completion-common-string): New variable.
(completion-setup-function): Use `completion-common-string'.
* emacs-lisp/lisp.el (lisp-complete-symbol): Bind
the completion pattern to `completion-common-string'.
Index: lisp/emacs-lisp/lisp.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/lisp.el,v
retrieving revision 1.68
diff -u -r1.68 lisp.el
--- lisp/emacs-lisp/lisp.el 6 Aug 2005 17:08:59 -0000 1.68
+++ lisp/emacs-lisp/lisp.el 8 Oct 2005 05:34:44 -0000
@@ -585,8 +585,9 @@
new))
(setq list (cdr list)))
(setq list (nreverse new))))
- (with-output-to-temp-buffer "*Completions*"
- (display-completion-list list)))
+ (let ((completion-common-string pattern))
+ (with-output-to-temp-buffer "*Completions*"
+ (display-completion-list list))))
(message "Making completion list...%s" "done")))))))
;;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e
Index: lisp/simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.754
diff -u -r1.754 simple.el
--- lisp/simple.el 6 Oct 2005 06:55:45 -0000 1.754
+++ lisp/simple.el 8 Oct 2005 05:34:45 -0000
@@ -4867,6 +4867,20 @@
(defvar completion-root-regexp "^/"
"Regexp to use in `completion-setup-function' to find the root directory.")
+(defvar completion-common-string nil
+ "Common prefix substring to use in `completion-setup-function' to put faces.
+Set this variable when completion is performed in a buffer other than minibuffer.
+
+To put faces, `completions-first-difference' and `completions-common-part'
+into \"*Completions*\* buffer, the common prefix substring in completions is
+needed as a hint. (Minibuffer is a special case. The content of minibuffer itself
+is the substring.)
+
+Typical usage:
+\(let ((completion-common-string pattern))
+ (with-output-to-temp-buffer \"*Completions*\"
+ (display-completion-list (all-completions pattern obarray predicate)))))")
+
(defun completion-setup-function ()
(let ((mainbuf (current-buffer))
(mbuf-contents (minibuffer-contents)))
@@ -4905,9 +4919,11 @@
(funcall (get minibuffer-completion-table 'completion-base-size-function)))
(setq completion-base-size 0))))
;; Put faces on first uncommon characters and common parts.
- (when completion-base-size
+ (when (or completion-base-size completion-common-string)
(let* ((common-string-length
- (- (length mbuf-contents) completion-base-size))
+ (if completion-base-size
+ (- (length mbuf-contents) completion-base-size)
+ (length completion-common-string)))
(element-start (next-single-property-change
(point-min)
'mouse-face))
next reply other threads:[~2005-10-08 7:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-08 7:02 Masatake YAMATO [this message]
2005-10-08 22:55 ` Enhanced enhanced visual feedback in `*Completions*' buffer Richard M. Stallman
2005-10-09 4:16 ` Masatake YAMATO
2005-10-09 19:12 ` Masatake YAMATO
2005-10-10 4:15 ` Richard M. Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051008.160207.188502984.jet@gyve.org \
--to=jet@gyve.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.