changeset 67618:40cdd21343f8

(Fminibuffer_completion_contents): New Lisp function created from minibuffer_completion_contents. (minibuffer_completion_contents): Remove. (do_completion, Fminibuffer_complete_word) (Fminibuffer_completion_help): Replace minibuffer_completion_contents with Fminibuffer_completion_contents. (syms_of_minibuf): Add Sminibuffer_completion_contents. (Fdisplay_completion_list): Doc fix. (display_completion_list_1): Use `nil' for second arg of `Fdisplay_completion_list'.
author Juri Linkov <juri@jurta.org>
date Fri, 16 Dec 2005 19:03:17 +0000
parents 765db9c82523
children 8ae5d2f218aa
files src/minibuf.c
diffstat 1 files changed, 25 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/minibuf.c	Fri Dec 16 15:44:39 2005 +0000
+++ b/src/minibuf.c	Fri Dec 16 19:03:17 2005 +0000
@@ -388,6 +388,19 @@
   return make_buffer_string (prompt_end, ZV, 0);
 }
 
+DEFUN ("minibuffer-completion-contents", Fminibuffer_completion_contents,
+       Sminibuffer_completion_contents, 0, 0, 0,
+       doc: /* Return the user input in a minibuffer before point as a string.
+That is what completion commands operate on.
+The current buffer must be a minibuffer.  */)
+     ()
+{
+  int prompt_end = XINT (Fminibuffer_prompt_end ());
+  if (PT < prompt_end)
+    error ("Cannot do completion in the prompt");
+  return make_buffer_string (prompt_end, PT, 1);
+}
+
 DEFUN ("delete-minibuffer-contents", Fdelete_minibuffer_contents,
        Sdelete_minibuffer_contents, 0, 0, 0,
        doc: /* Delete all user input in a minibuffer.
@@ -400,17 +413,6 @@
   return Qnil;
 }
 
-/* Get the text in the minibuffer before point.
-   That is what completion commands operate on.  */
-
-Lisp_Object
-minibuffer_completion_contents ()
-{
-  int prompt_end = XINT (Fminibuffer_prompt_end ());
-  if (PT < prompt_end)
-    error ("Cannot do completion in the prompt");
-  return make_buffer_string (prompt_end, PT, 1);
-}
 
 /* Read from the minibuffer using keymap MAP and initial contents INITIAL,
    putting point minus BACKUP_N bytes from the end of INITIAL,
@@ -1899,7 +1901,7 @@
   Lisp_Object last;
   struct gcpro gcpro1, gcpro2;
 
-  completion = Ftry_completion (minibuffer_completion_contents (),
+  completion = Ftry_completion (Fminibuffer_completion_contents (),
 				Vminibuffer_completion_table,
 				Vminibuffer_completion_predicate);
   last = last_exact_completion;
@@ -1921,7 +1923,7 @@
       return 1;
     }
 
-  string = minibuffer_completion_contents ();
+  string = Fminibuffer_completion_contents ();
 
   /* COMPLETEDP should be true if some completion was done, which
      doesn't include simply changing the case of the entered string.
@@ -1988,7 +1990,7 @@
   last_exact_completion = completion;
   if (!NILP (last))
     {
-      tem = minibuffer_completion_contents ();
+      tem = Fminibuffer_completion_contents ();
       if (!NILP (Fequal (tem, last)))
 	Fminibuffer_completion_help ();
     }
@@ -2191,7 +2193,7 @@
   /* We keep calling Fbuffer_string rather than arrange for GC to
      hold onto a pointer to one of the strings thus made.  */
 
-  completion = Ftry_completion (minibuffer_completion_contents (),
+  completion = Ftry_completion (Fminibuffer_completion_contents (),
 				Vminibuffer_completion_table,
 				Vminibuffer_completion_predicate);
   if (NILP (completion))
@@ -2223,7 +2225,7 @@
     int buffer_nchars, completion_nchars;
 
     CHECK_STRING (completion);
-    tem = minibuffer_completion_contents ();
+    tem = Fminibuffer_completion_contents ();
     GCPRO2 (completion, tem);
     /* If reading a file name,
        expand any $ENVVAR refs in the buffer and in TEM.  */
@@ -2287,7 +2289,7 @@
   if (i == SCHARS (completion))
     {
       GCPRO1 (completion);
-      tem = Ftry_completion (concat2 (minibuffer_completion_contents (),
+      tem = Ftry_completion (concat2 (Fminibuffer_completion_contents (),
 				      build_string (" ")),
 			     Vminibuffer_completion_table,
 			     Vminibuffer_completion_predicate);
@@ -2299,7 +2301,7 @@
 	{
 	  GCPRO1 (completion);
 	  tem =
-	    Ftry_completion (concat2 (minibuffer_completion_contents (),
+	    Ftry_completion (concat2 (Fminibuffer_completion_contents (),
 				      build_string ("-")),
 			     Vminibuffer_completion_table,
 			     Vminibuffer_completion_predicate);
@@ -2371,8 +2373,8 @@
 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.
+specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil
+and the current buffer is not the minibuffer, the faces are not put.
 Internally, COMMON-SUBSTRING is bound to `completion-common-substring'
 during running `completion-setup-hook'. */)
      (completions, common_substring)
@@ -2563,7 +2565,7 @@
 display_completion_list_1 (list)
      Lisp_Object list;
 {
-  return Fdisplay_completion_list (list, minibuffer_completion_contents ());
+  return Fdisplay_completion_list (list, Qnil);
 }
 
 DEFUN ("minibuffer-completion-help", Fminibuffer_completion_help, Sminibuffer_completion_help,
@@ -2574,7 +2576,7 @@
   Lisp_Object completions;
 
   message ("Making completion list...");
-  completions = Fall_completions (minibuffer_completion_contents (),
+  completions = Fall_completions (Fminibuffer_completion_contents (),
 				  Vminibuffer_completion_table,
 				  Vminibuffer_completion_predicate,
 				  Qt);
@@ -2883,6 +2885,7 @@
   defsubr (&Sminibuffer_prompt_end);
   defsubr (&Sminibuffer_contents);
   defsubr (&Sminibuffer_contents_no_properties);
+  defsubr (&Sminibuffer_completion_contents);
   defsubr (&Sdelete_minibuffer_contents);
 
   defsubr (&Stry_completion);