Mercurial > emacs
comparison src/minibuf.c @ 56087:3d12da599e18
(Ftry_completion, Fall_completions, Ftest_completion):
Avoid calling specbind when completion-regexp-list is empty.
author | Andreas Schwab <schwab@suse.de> |
---|---|
date | Sun, 13 Jun 2004 22:20:55 +0000 |
parents | 082785bed641 |
children | ce63b548f490 38500c0c86ab |
comparison
equal
deleted
inserted
replaced
56086:c5c08e52e9d6 | 56087:3d12da599e18 |
---|---|
1283 Lisp_Object regexps; | 1283 Lisp_Object regexps; |
1284 Lisp_Object zero; | 1284 Lisp_Object zero; |
1285 XSETFASTINT (zero, 0); | 1285 XSETFASTINT (zero, 0); |
1286 | 1286 |
1287 /* Ignore this element if it fails to match all the regexps. */ | 1287 /* Ignore this element if it fails to match all the regexps. */ |
1288 { | 1288 if (CONSP (Vcompletion_regexp_list)) |
1289 int count = SPECPDL_INDEX (); | 1289 { |
1290 specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); | 1290 int count = SPECPDL_INDEX (); |
1291 for (regexps = Vcompletion_regexp_list; CONSP (regexps); | 1291 specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); |
1292 regexps = XCDR (regexps)) | 1292 for (regexps = Vcompletion_regexp_list; CONSP (regexps); |
1293 { | 1293 regexps = XCDR (regexps)) |
1294 tem = Fstring_match (XCAR (regexps), eltstring, zero); | 1294 { |
1295 if (NILP (tem)) | 1295 tem = Fstring_match (XCAR (regexps), eltstring, zero); |
1296 break; | 1296 if (NILP (tem)) |
1297 } | 1297 break; |
1298 unbind_to (count, Qnil); | 1298 } |
1299 if (CONSP (regexps)) | 1299 unbind_to (count, Qnil); |
1300 continue; | 1300 if (CONSP (regexps)) |
1301 } | 1301 continue; |
1302 } | |
1302 | 1303 |
1303 /* Ignore this element if there is a predicate | 1304 /* Ignore this element if there is a predicate |
1304 and the predicate doesn't like it. */ | 1305 and the predicate doesn't like it. */ |
1305 | 1306 |
1306 if (!NILP (predicate)) | 1307 if (!NILP (predicate)) |
1534 Lisp_Object regexps; | 1535 Lisp_Object regexps; |
1535 Lisp_Object zero; | 1536 Lisp_Object zero; |
1536 XSETFASTINT (zero, 0); | 1537 XSETFASTINT (zero, 0); |
1537 | 1538 |
1538 /* Ignore this element if it fails to match all the regexps. */ | 1539 /* Ignore this element if it fails to match all the regexps. */ |
1539 { | 1540 if (CONSP (Vcompletion_regexp_list)) |
1540 int count = SPECPDL_INDEX (); | 1541 { |
1541 specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); | 1542 int count = SPECPDL_INDEX (); |
1542 for (regexps = Vcompletion_regexp_list; CONSP (regexps); | 1543 specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); |
1543 regexps = XCDR (regexps)) | 1544 for (regexps = Vcompletion_regexp_list; CONSP (regexps); |
1544 { | 1545 regexps = XCDR (regexps)) |
1545 tem = Fstring_match (XCAR (regexps), eltstring, zero); | 1546 { |
1546 if (NILP (tem)) | 1547 tem = Fstring_match (XCAR (regexps), eltstring, zero); |
1547 break; | 1548 if (NILP (tem)) |
1548 } | 1549 break; |
1549 unbind_to (count, Qnil); | 1550 } |
1550 if (CONSP (regexps)) | 1551 unbind_to (count, Qnil); |
1551 continue; | 1552 if (CONSP (regexps)) |
1552 } | 1553 continue; |
1554 } | |
1553 | 1555 |
1554 /* Ignore this element if there is a predicate | 1556 /* Ignore this element if there is a predicate |
1555 and the predicate doesn't like it. */ | 1557 and the predicate doesn't like it. */ |
1556 | 1558 |
1557 if (!NILP (predicate)) | 1559 if (!NILP (predicate)) |
1782 } | 1784 } |
1783 else | 1785 else |
1784 return call3 (alist, string, predicate, Qlambda); | 1786 return call3 (alist, string, predicate, Qlambda); |
1785 | 1787 |
1786 /* Reject this element if it fails to match all the regexps. */ | 1788 /* Reject this element if it fails to match all the regexps. */ |
1787 { | 1789 if (CONSP (Vcompletion_regexp_list)) |
1788 int count = SPECPDL_INDEX (); | 1790 { |
1789 specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); | 1791 int count = SPECPDL_INDEX (); |
1790 for (regexps = Vcompletion_regexp_list; CONSP (regexps); | 1792 specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); |
1791 regexps = XCDR (regexps)) | 1793 for (regexps = Vcompletion_regexp_list; CONSP (regexps); |
1792 { | 1794 regexps = XCDR (regexps)) |
1793 if (NILP (Fstring_match (XCAR (regexps), | 1795 { |
1794 SYMBOLP (tem) ? string : tem, | 1796 if (NILP (Fstring_match (XCAR (regexps), |
1795 Qnil))) | 1797 SYMBOLP (tem) ? string : tem, |
1796 return unbind_to (count, Qnil); | 1798 Qnil))) |
1797 } | 1799 return unbind_to (count, Qnil); |
1798 unbind_to (count, Qnil); | 1800 } |
1799 } | 1801 unbind_to (count, Qnil); |
1802 } | |
1800 | 1803 |
1801 /* Finally, check the predicate. */ | 1804 /* Finally, check the predicate. */ |
1802 if (!NILP (predicate)) | 1805 if (!NILP (predicate)) |
1803 { | 1806 { |
1804 return HASH_TABLE_P (alist) | 1807 return HASH_TABLE_P (alist) |