--- minibuf.c 15 Jun 2004 00:47:07 +0200 1.269 +++ minibuf.c 15 Jun 2004 15:22:48 +0200 @@ -1207,6 +1207,7 @@ || NILP (XCAR (alist)))); int index = 0, obsize = 0; int matchcount = 0; + int bind_count = -1; Lisp_Object bucket, zero, end, tem; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -1285,21 +1286,22 @@ 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; + { + for (regexps = Vcompletion_regexp_list; CONSP (regexps); + regexps = XCDR (regexps)) + { + if (bind_count < 0) { + bind_count = SPECPDL_INDEX (); + specbind (Qcase_fold_search, + completion_ignore_case ? Qt : Qnil); } - unbind_to (count, Qnil); - if (CONSP (regexps)) - continue; - } + 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,6 +1312,10 @@ tem = Fcommandp (elt, Qnil); else { + if (bind_count >= 0) { + unbind_to (bind_count, Qnil); + bind_count = -1; + } GCPRO4 (tail, string, eltstring, bestmatch); tem = type == 3 ? call2 (predicate, elt, @@ -1391,6 +1397,11 @@ } } + if (bind_count >= 0) { + unbind_to (bind_count, Qnil); + bind_count = -1; + } + if (NILP (bestmatch)) return Qnil; /* No completions found */ /* If we are ignoring case, and there is no exact match, @@ -1453,6 +1464,7 @@ && (!SYMBOLP (XCAR (alist)) || NILP (XCAR (alist)))); int index = 0, obsize = 0; + int bind_count = -1; Lisp_Object bucket, tem; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -1537,21 +1549,22 @@ 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; + { + for (regexps = Vcompletion_regexp_list; CONSP (regexps); + regexps = XCDR (regexps)) + { + if (bind_count < 0) { + bind_count = SPECPDL_INDEX (); + specbind (Qcase_fold_search, + completion_ignore_case ? Qt : Qnil); } - unbind_to (count, Qnil); - if (CONSP (regexps)) - continue; - } + 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,6 +1575,10 @@ tem = Fcommandp (elt, Qnil); else { + if (bind_count >= 0) { + unbind_to (bind_count, Qnil); + bind_count = -1; + } GCPRO4 (tail, eltstring, allmatches, string); tem = type == 3 ? call2 (predicate, elt, @@ -1576,6 +1593,11 @@ } } + if (bind_count >= 0) { + unbind_to (bind_count, Qnil); + bind_count = -1; + } + return Fnreverse (allmatches); }