From f5fab556d45e13d12f83b2d8cd49fe343546c2f6 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Sun, 16 Oct 2005 09:31:48 +0000 Subject: * message.el (message-expand-group): Pass the common prefix substring of completion to `display-completion-list'. * mh-comp.el (mh-complete-word): Pass the common prefix substring of completion to `display-completion-list'. * dabbrev.el (dabbrev-completion): Pass the common prefix substring of completion to `display-completion-list'. * filecache.el (file-cache-minibuffer-complete) (file-cache-complete): Ditto. * tempo.el (tempo-display-completions): Ditto. * wid-edit.el (widget-file-complete, widget-color-complete): Ditto. * emacs-lisp/lisp.el (lisp-complete-symbol): Ditto. * eshell/em-hist.el (eshell-list-history): Ditto. * mail/mailabbrev.el (mail-abbrev-complete-alias): Ditto. * progmodes/etags.el (complete-tag): Ditto. * progmodes/make-mode.el (makefile-complete): Ditto. * progmodes/meta-mode.el (meta-complete-symbol): Ditto. * progmodes/octave-mod.el (octave-complete-symbol): Ditto. * progmodes/pascal.el (pascal-complete-word) (pascal-show-completions): Ditto. * textmodes/bibtex.el (bibtex-complete-internal): Ditto. * simple.el (completion-common-substring): New variable. (completion-setup-function): Use `completion-common-substring' to put faces. * minibuf.c (Fdisplay_completion_list): Add new optional argument COMMON_SUBSTRING. Bind `completion-common-substring' to the optional argument during running `completion-setup-hook'. --- src/minibuf.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/minibuf.c') diff --git a/src/minibuf.c b/src/minibuf.c index 28789b60bde..d7ef048c138 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2351,7 +2351,7 @@ Return nil if there is no valid completion, else t. */) } DEFUN ("display-completion-list", Fdisplay_completion_list, Sdisplay_completion_list, - 1, 1, 0, + 1, 2, 0, doc: /* Display the list of completions, COMPLETIONS, using `standard-output'. Each element may be just a symbol or string or may be a list of two strings to be printed as if concatenated. @@ -2361,14 +2361,23 @@ alternative, the second serves as annotation. The actual completion alternatives, as inserted, are given `mouse-face' properties of `highlight'. At the end, this runs the normal hook `completion-setup-hook'. -It can find the completion buffer in `standard-output'. */) - (completions) +It can find the completion buffer in `standard-output'. +The optional second arg COMMON-SUBSTRING is a string. +It is used to put faces, `completions-first-difference` and +`completions-common-part' on the completion bufffer. The +`completions-common-part' face is put on the common substring +specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil, +the faces are not put. +Internally, COMMON-SUBSTRING is bound to `completion-common-substring' +during running `completion-setup-hook'. */) + (completions, common_substring) Lisp_Object completions; + Lisp_Object common_substring; { Lisp_Object tail, elt; register int i; int column = 0; - struct gcpro gcpro1, gcpro2; + struct gcpro gcpro1, gcpro2, gcpro3; struct buffer *old = current_buffer; int first = 1; @@ -2377,7 +2386,7 @@ It can find the completion buffer in `standard-output'. */) except for ELT. ELT can be pointing to a string when terpri or Findent_to calls a change hook. */ elt = Qnil; - GCPRO2 (completions, elt); + GCPRO3 (completions, elt, common_substring); if (BUFFERP (Vstandard_output)) set_buffer_internal (XBUFFER (Vstandard_output)); @@ -2526,13 +2535,20 @@ It can find the completion buffer in `standard-output'. */) } } - UNGCPRO; - if (BUFFERP (Vstandard_output)) set_buffer_internal (old); if (!NILP (Vrun_hooks)) - call1 (Vrun_hooks, intern ("completion-setup-hook")); + { + int count1 = SPECPDL_INDEX (); + + specbind (intern ("completion-common-substring"), common_substring); + call1 (Vrun_hooks, intern ("completion-setup-hook")); + + unbind_to (count1, Qnil); + } + + UNGCPRO; return Qnil; } -- cgit v1.2.1 From 26e9d2cf1adc0d7a13e9f130055d0cb2c5707564 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 20 Oct 2005 13:07:29 +0000 Subject: (Fdisplay_completion_list): Doc fix. --- src/minibuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/minibuf.c') diff --git a/src/minibuf.c b/src/minibuf.c index d7ef048c138..833f72c0500 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2364,7 +2364,7 @@ At the end, this runs the normal hook `completion-setup-hook'. It can find the completion buffer in `standard-output'. The optional second arg COMMON-SUBSTRING is a string. It is used to put faces, `completions-first-difference` and -`completions-common-part' on the completion bufffer. The +`completions-common-part' on the completion buffer. The `completions-common-part' face is put on the common substring specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil, the faces are not put. -- cgit v1.2.1 From d6ae289cf04522aad21432be9180027aaafee434 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Thu, 20 Oct 2005 15:03:32 +0000 Subject: (display_completion_list_1): New wrapper function for Fdisplay_completion_list. (Fminibuffer_completion_help): Use it. --- src/minibuf.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/minibuf.c') diff --git a/src/minibuf.c b/src/minibuf.c index 833f72c0500..045223948c6 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2361,14 +2361,14 @@ alternative, the second serves as annotation. The actual completion alternatives, as inserted, are given `mouse-face' properties of `highlight'. At the end, this runs the normal hook `completion-setup-hook'. -It can find the completion buffer in `standard-output'. -The optional second arg COMMON-SUBSTRING is a string. +It can find the completion buffer in `standard-output'. +The optional second arg COMMON-SUBSTRING is a string. It is used to put faces, `completions-first-difference` and `completions-common-part' on the completion buffer. The `completions-common-part' face is put on the common substring specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil, -the faces are not put. -Internally, COMMON-SUBSTRING is bound to `completion-common-substring' +the faces are not put. +Internally, COMMON-SUBSTRING is bound to `completion-common-substring' during running `completion-setup-hook'. */) (completions, common_substring) Lisp_Object completions; @@ -2544,7 +2544,7 @@ during running `completion-setup-hook'. */) specbind (intern ("completion-common-substring"), common_substring); call1 (Vrun_hooks, intern ("completion-setup-hook")); - + unbind_to (count1, Qnil); } @@ -2553,6 +2553,14 @@ during running `completion-setup-hook'. */) return Qnil; } + +static Lisp_Object +display_completion_list_1 (list) + Lisp_Object list; +{ + return Fdisplay_completion_list (list, Qnil); +} + DEFUN ("minibuffer-completion-help", Fminibuffer_completion_help, Sminibuffer_completion_help, 0, 0, "", doc: /* Display a list of possible completions of the current minibuffer contents. */) @@ -2574,7 +2582,7 @@ DEFUN ("minibuffer-completion-help", Fminibuffer_completion_help, Sminibuffer_co } else internal_with_output_to_temp_buffer ("*Completions*", - Fdisplay_completion_list, + display_completion_list_1, Fsort (completions, Qstring_lessp)); return Qnil; } -- cgit v1.2.1