emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/minibuf.c


From: David Kastrup
Subject: [Emacs-diffs] Changes to emacs/src/minibuf.c
Date: Sun, 20 Jun 2004 18:29:49 -0400

Index: emacs/src/minibuf.c
diff -c emacs/src/minibuf.c:1.269 emacs/src/minibuf.c:1.270
*** emacs/src/minibuf.c:1.269   Sun Jun 13 22:20:55 2004
--- emacs/src/minibuf.c Sun Jun 20 22:29:46 2004
***************
*** 1207,1212 ****
--- 1207,1213 ----
                           || NILP (XCAR (alist))));
    int index = 0, obsize = 0;
    int matchcount = 0;
+   int bindcount = -1;
    Lisp_Object bucket, zero, end, tem;
    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
  
***************
*** 1285,1305 ****
          XSETFASTINT (zero, 0);
  
          /* Ignore this element if it fails to match all the regexps.  */
!         if (CONSP (Vcompletion_regexp_list))
!           {
!             int count = SPECPDL_INDEX ();
!             specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
!             for (regexps = Vcompletion_regexp_list; CONSP (regexps);
!                  regexps = XCDR (regexps))
!               {
!                 tem = Fstring_match (XCAR (regexps), eltstring, zero);
!                 if (NILP (tem))
!                   break;
                }
!             unbind_to (count, Qnil);
!             if (CONSP (regexps))
!               continue;
!           }
  
          /* Ignore this element if there is a predicate
             and the predicate doesn't like it. */
--- 1286,1307 ----
          XSETFASTINT (zero, 0);
  
          /* Ignore this element if it fails to match all the regexps.  */
!         {
!           for (regexps = Vcompletion_regexp_list; CONSP (regexps);
!                regexps = XCDR (regexps))
!             {
!               if (bindcount < 0) {
!                 bindcount = SPECPDL_INDEX ();
!                 specbind (Qcase_fold_search,
!                           completion_ignore_case ? Qt : Qnil);
                }
!               tem = Fstring_match (XCAR (regexps), eltstring, zero);
!               if (NILP (tem))
!                 break;
!             }
!           if (CONSP (regexps))
!             continue;
!         }
  
          /* Ignore this element if there is a predicate
             and the predicate doesn't like it. */
***************
*** 1310,1315 ****
--- 1312,1321 ----
                tem = Fcommandp (elt, Qnil);
              else
                {
+                 if (bindcount >= 0) {
+                   unbind_to (bindcount, Qnil);
+                   bindcount = -1;
+                 }
                  GCPRO4 (tail, string, eltstring, bestmatch);
                  tem = type == 3
                    ? call2 (predicate, elt,
***************
*** 1391,1396 ****
--- 1397,1407 ----
        }
      }
  
+   if (bindcount >= 0) {
+     unbind_to (bindcount, Qnil);
+     bindcount = -1;
+   }
+ 
    if (NILP (bestmatch))
      return Qnil;              /* No completions found */
    /* If we are ignoring case, and there is no exact match,
***************
*** 1453,1458 ****
--- 1464,1470 ----
                       && (!SYMBOLP (XCAR (alist))
                           || NILP (XCAR (alist))));
    int index = 0, obsize = 0;
+   int bindcount = -1;
    Lisp_Object bucket, tem;
    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
  
***************
*** 1537,1557 ****
          XSETFASTINT (zero, 0);
  
          /* Ignore this element if it fails to match all the regexps.  */
!         if (CONSP (Vcompletion_regexp_list))
!           {
!             int count = SPECPDL_INDEX ();
!             specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
!             for (regexps = Vcompletion_regexp_list; CONSP (regexps);
!                  regexps = XCDR (regexps))
!               {
!                 tem = Fstring_match (XCAR (regexps), eltstring, zero);
!                 if (NILP (tem))
!                   break;
                }
!             unbind_to (count, Qnil);
!             if (CONSP (regexps))
!               continue;
!           }
  
          /* Ignore this element if there is a predicate
             and the predicate doesn't like it. */
--- 1549,1570 ----
          XSETFASTINT (zero, 0);
  
          /* Ignore this element if it fails to match all the regexps.  */
!         {
!           for (regexps = Vcompletion_regexp_list; CONSP (regexps);
!                regexps = XCDR (regexps))
!             {
!               if (bindcount < 0) {
!                 bindcount = SPECPDL_INDEX ();
!                 specbind (Qcase_fold_search,
!                           completion_ignore_case ? Qt : Qnil);
                }
!               tem = Fstring_match (XCAR (regexps), eltstring, zero);
!               if (NILP (tem))
!                 break;
!             }
!           if (CONSP (regexps))
!             continue;
!         }
  
          /* Ignore this element if there is a predicate
             and the predicate doesn't like it. */
***************
*** 1562,1567 ****
--- 1575,1584 ----
                tem = Fcommandp (elt, Qnil);
              else
                {
+                 if (bindcount >= 0) {
+                   unbind_to (bindcount, Qnil);
+                   bindcount = -1;
+                 }
                  GCPRO4 (tail, eltstring, allmatches, string);
                  tem = type == 3
                    ? call2 (predicate, elt,
***************
*** 1576,1581 ****
--- 1593,1603 ----
        }
      }
  
+   if (bindcount >= 0) {
+     unbind_to (bindcount, Qnil);
+     bindcount = -1;
+   }
+ 
    return Fnreverse (allmatches);
  }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]