diff options
| author | Andreas Schwab | 2004-06-13 22:20:55 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2004-06-13 22:20:55 +0000 |
| commit | 774437897d285d027dbda7799a2bffda4ec6c92e (patch) | |
| tree | 069ba19d09f39e6daf9a3133aa289b426a1df13f | |
| parent | 7ae8ad948e6135155bcfe54a41e09e1eafa1414d (diff) | |
| download | emacs-774437897d285d027dbda7799a2bffda4ec6c92e.tar.gz emacs-774437897d285d027dbda7799a2bffda4ec6c92e.zip | |
(Ftry_completion, Fall_completions, Ftest_completion):
Avoid calling specbind when completion-regexp-list is empty.
| -rw-r--r-- | src/minibuf.c | 85 |
1 files changed, 44 insertions, 41 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index c33a1338600..ee37142a4a6 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1285,20 +1285,21 @@ is used to further constrain the set of candidates. */) | |||
| 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. */ |
| @@ -1536,20 +1537,21 @@ are ignored unless STRING itself starts with a space. */) | |||
| 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. */ |
| @@ -1784,19 +1786,20 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 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)) |