diff src/minibuf.c @ 6689:2efd8c4eb9be

(do_completion): gcpro some things.
author Karl Heuer <kwzh@gnu.org>
date Tue, 05 Apr 1994 22:53:54 +0000
parents 2c66255e9469
children 4fe5b1447c3f
line wrap: on
line diff
--- a/src/minibuf.c	Tue Apr 05 21:54:51 1994 +0000
+++ b/src/minibuf.c	Tue Apr 05 22:53:54 1994 +0000
@@ -1045,7 +1045,9 @@
   Lisp_Object completion, tem;
   int completedp;
   Lisp_Object last;
+  struct gcpro gcpro1, gcpro2;
 
+  GCPRO2 (completion, last);
   completion = Ftry_completion (Fbuffer_string (), Vminibuffer_completion_table,
 				Vminibuffer_completion_predicate);
   last = last_exact_completion;
@@ -1055,11 +1057,15 @@
     {
       bitch_at_user ();
       temp_echo_area_glyphs (" [No match]");
+      UNGCPRO;
       return 0;
     }
 
   if (EQ (completion, Qt))	/* exact and unique match */
-    return 1;
+    {
+      UNGCPRO;
+      return 1;
+    }
 
   /* compiler bug */
   tem = Fstring_equal (completion, Fbuffer_string());
@@ -1097,7 +1103,9 @@
 		 Qlambda);
 
   if (NILP (tem))
-    { /* not an exact match */
+    {
+      /* not an exact match */
+      UNGCPRO;
       if (completedp)
 	return 5;
       else if (auto_help)
@@ -1107,7 +1115,10 @@
       return 6;
     }
   else if (completedp)
-    return 4;
+    {
+      UNGCPRO;
+      return 4;
+    }
   /* If the last exact completion and this one were the same,
      it means we've already given a "Complete but not unique"
      message and the user's hit TAB again, so now we give him help.  */
@@ -1118,9 +1129,10 @@
       if (!NILP (Fequal (tem, last)))
 	Fminibuffer_completion_help ();
     }
+  UNGCPRO;
   return 3;
 }
-  
+
 /* Like assoc but assumes KEY is a string, and ignores case if appropriate.  */
 
 Lisp_Object
@@ -1562,6 +1574,9 @@
   Qminibuffer_completion_predicate = intern ("minibuffer-completion-predicate");
   staticpro (&Qminibuffer_completion_predicate);
 
+  staticpro (&last_exact_completion);
+  last_exact_completion = Qnil;
+
   staticpro (&last_minibuf_string);
   last_minibuf_string = Qnil;