summaryrefslogtreecommitdiff
path: root/src/minibuf.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2006-01-16 06:59:21 +0000
committerMiles Bader <miles@gnu.org>2006-01-16 06:59:21 +0000
commit6a2bd1a5019d2130c87ac5cf17f1322bf614b624 (patch)
tree8e72a4a1b7c177b494ae7721f00ea27b14f9f439 /src/minibuf.c
parent5bb51be51248803e7400837b83c711854fa86648 (diff)
parent292f71fe67394186e943783bef808c611699b63c (diff)
downloademacs-6a2bd1a5019d2130c87ac5cf17f1322bf614b624.tar.gz
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-95
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 598-615) - Update from CVS - Remove lisp/toolbar directory - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 142-146) - Update from CVS
Diffstat (limited to 'src/minibuf.c')
-rw-r--r--src/minibuf.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index b7f9fd4838c..74d55a8abfd 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -2342,7 +2342,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.
@@ -2352,14 +2352,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 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'
+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;
@@ -2368,7 +2377,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));
@@ -2517,17 +2526,32 @@ 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;
}
+
+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. */)
@@ -2549,7 +2573,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;
}