diff options
| author | Richard M. Stallman | 2007-01-28 07:16:39 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2007-01-28 07:16:39 +0000 |
| commit | a284cdbbeec879ced6157cd5d62a60c0d23e77ff (patch) | |
| tree | 6ecb1e27948c223f7c4e4d1254cd432d6e8ea470 /src | |
| parent | bbc02d0063f2eb4f291449ef2e0449efea2ce6fd (diff) | |
| download | emacs-a284cdbbeec879ced6157cd5d62a60c0d23e77ff.tar.gz emacs-a284cdbbeec879ced6157cd5d62a60c0d23e77ff.zip | |
(Ftry_completion, Fall_completions, Fcompleting_read, Ftest_completion):
Rename arg ALIST or TABLE to COLLECTION.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 186 |
1 files changed, 94 insertions, 92 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index 9c078a37b3d..95b1b7fe86c 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1230,22 +1230,25 @@ minibuf_conform_representation (string, basis) | |||
| 1230 | } | 1230 | } |
| 1231 | 1231 | ||
| 1232 | DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0, | 1232 | DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0, |
| 1233 | doc: /* Return common substring of all completions of STRING in ALIST. | 1233 | doc: /* Return common substring of all completions of STRING in COLLECTION. |
| 1234 | Each car of each element of ALIST (or each element if it is not a cons cell) | 1234 | Test each possible completion specified by COLLECTION |
| 1235 | is tested to see if it begins with STRING. The possible matches may be | 1235 | to see if it begins with STRING. The possible completions may be |
| 1236 | strings or symbols. Symbols are converted to strings before testing, | 1236 | strings or symbols. Symbols are converted to strings before testing, |
| 1237 | see `symbol-name'. | 1237 | see `symbol-name'. |
| 1238 | All that match are compared together; the longest initial sequence | 1238 | All that match STRING are compared together; the longest initial sequence |
| 1239 | common to all matches is returned as a string. | 1239 | common to all these matches is the return value. |
| 1240 | If there is no match at all, nil is returned. | 1240 | If there is no match at all, the return value is nil. |
| 1241 | For a unique match which is exact, t is returned. | 1241 | For a unique match which is exact, the return value is t. |
| 1242 | 1242 | ||
| 1243 | If ALIST is a hash-table, all the string and symbol keys are the | 1243 | If COLLECTION is an alist, the keys (cars of elements) are the |
| 1244 | possible matches. | 1244 | possible completions. If an element is not a cons cell, then the |
| 1245 | If ALIST is an obarray, the names of all symbols in the obarray | 1245 | element itself is the possible completion. |
| 1246 | are the possible matches. | 1246 | If COLLECTION is a hash-table, all the keys that are strings or symbols |
| 1247 | 1247 | are the possible completions. | |
| 1248 | ALIST can also be a function to do the completion itself. | 1248 | If COLLECTION is an obarray, the names of all symbols in the obarray |
| 1249 | are the possible completions. | ||
| 1250 | |||
| 1251 | COLLECTION can also be a function to do the completion itself. | ||
| 1249 | It receives three arguments: the values STRING, PREDICATE and nil. | 1252 | It receives three arguments: the values STRING, PREDICATE and nil. |
| 1250 | Whatever it returns becomes the value of `try-completion'. | 1253 | Whatever it returns becomes the value of `try-completion'. |
| 1251 | 1254 | ||
| @@ -1253,23 +1256,23 @@ If optional third argument PREDICATE is non-nil, | |||
| 1253 | it is used to test each possible match. | 1256 | it is used to test each possible match. |
| 1254 | The match is a candidate only if PREDICATE returns non-nil. | 1257 | The match is a candidate only if PREDICATE returns non-nil. |
| 1255 | The argument given to PREDICATE is the alist element | 1258 | The argument given to PREDICATE is the alist element |
| 1256 | or the symbol from the obarray. If ALIST is a hash-table, | 1259 | or the symbol from the obarray. If COLLECTION is a hash-table, |
| 1257 | predicate is called with two arguments: the key and the value. | 1260 | predicate is called with two arguments: the key and the value. |
| 1258 | Additionally to this predicate, `completion-regexp-list' | 1261 | Additionally to this predicate, `completion-regexp-list' |
| 1259 | is used to further constrain the set of candidates. */) | 1262 | is used to further constrain the set of candidates. */) |
| 1260 | (string, alist, predicate) | 1263 | (string, collection, predicate) |
| 1261 | Lisp_Object string, alist, predicate; | 1264 | Lisp_Object string, collection, predicate; |
| 1262 | { | 1265 | { |
| 1263 | Lisp_Object bestmatch, tail, elt, eltstring; | 1266 | Lisp_Object bestmatch, tail, elt, eltstring; |
| 1264 | /* Size in bytes of BESTMATCH. */ | 1267 | /* Size in bytes of BESTMATCH. */ |
| 1265 | int bestmatchsize = 0; | 1268 | int bestmatchsize = 0; |
| 1266 | /* These are in bytes, too. */ | 1269 | /* These are in bytes, too. */ |
| 1267 | int compare, matchsize; | 1270 | int compare, matchsize; |
| 1268 | int type = (HASH_TABLE_P (alist) ? 3 | 1271 | int type = (HASH_TABLE_P (collection) ? 3 |
| 1269 | : VECTORP (alist) ? 2 | 1272 | : VECTORP (collection) ? 2 |
| 1270 | : NILP (alist) || (CONSP (alist) | 1273 | : NILP (collection) || (CONSP (collection) |
| 1271 | && (!SYMBOLP (XCAR (alist)) | 1274 | && (!SYMBOLP (XCAR (collection)) |
| 1272 | || NILP (XCAR (alist))))); | 1275 | || NILP (XCAR (collection))))); |
| 1273 | int index = 0, obsize = 0; | 1276 | int index = 0, obsize = 0; |
| 1274 | int matchcount = 0; | 1277 | int matchcount = 0; |
| 1275 | int bindcount = -1; | 1278 | int bindcount = -1; |
| @@ -1278,18 +1281,18 @@ is used to further constrain the set of candidates. */) | |||
| 1278 | 1281 | ||
| 1279 | CHECK_STRING (string); | 1282 | CHECK_STRING (string); |
| 1280 | if (type == 0) | 1283 | if (type == 0) |
| 1281 | return call3 (alist, string, predicate, Qnil); | 1284 | return call3 (collection, string, predicate, Qnil); |
| 1282 | 1285 | ||
| 1283 | bestmatch = bucket = Qnil; | 1286 | bestmatch = bucket = Qnil; |
| 1284 | zero = make_number (0); | 1287 | zero = make_number (0); |
| 1285 | 1288 | ||
| 1286 | /* If ALIST is not a list, set TAIL just for gc pro. */ | 1289 | /* If COLLECTION is not a list, set TAIL just for gc pro. */ |
| 1287 | tail = alist; | 1290 | tail = collection; |
| 1288 | if (type == 2) | 1291 | if (type == 2) |
| 1289 | { | 1292 | { |
| 1290 | alist = check_obarray (alist); | 1293 | collection = check_obarray (collection); |
| 1291 | obsize = XVECTOR (alist)->size; | 1294 | obsize = XVECTOR (collection)->size; |
| 1292 | bucket = XVECTOR (alist)->contents[index]; | 1295 | bucket = XVECTOR (collection)->contents[index]; |
| 1293 | } | 1296 | } |
| 1294 | 1297 | ||
| 1295 | while (1) | 1298 | while (1) |
| @@ -1324,19 +1327,19 @@ is used to further constrain the set of candidates. */) | |||
| 1324 | break; | 1327 | break; |
| 1325 | else | 1328 | else |
| 1326 | { | 1329 | { |
| 1327 | bucket = XVECTOR (alist)->contents[index]; | 1330 | bucket = XVECTOR (collection)->contents[index]; |
| 1328 | continue; | 1331 | continue; |
| 1329 | } | 1332 | } |
| 1330 | } | 1333 | } |
| 1331 | else /* if (type == 3) */ | 1334 | else /* if (type == 3) */ |
| 1332 | { | 1335 | { |
| 1333 | while (index < HASH_TABLE_SIZE (XHASH_TABLE (alist)) | 1336 | while (index < HASH_TABLE_SIZE (XHASH_TABLE (collection)) |
| 1334 | && NILP (HASH_HASH (XHASH_TABLE (alist), index))) | 1337 | && NILP (HASH_HASH (XHASH_TABLE (collection), index))) |
| 1335 | index++; | 1338 | index++; |
| 1336 | if (index >= HASH_TABLE_SIZE (XHASH_TABLE (alist))) | 1339 | if (index >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) |
| 1337 | break; | 1340 | break; |
| 1338 | else | 1341 | else |
| 1339 | elt = eltstring = HASH_KEY (XHASH_TABLE (alist), index++); | 1342 | elt = eltstring = HASH_KEY (XHASH_TABLE (collection), index++); |
| 1340 | } | 1343 | } |
| 1341 | 1344 | ||
| 1342 | /* Is this element a possible completion? */ | 1345 | /* Is this element a possible completion? */ |
| @@ -1389,7 +1392,7 @@ is used to further constrain the set of candidates. */) | |||
| 1389 | GCPRO4 (tail, string, eltstring, bestmatch); | 1392 | GCPRO4 (tail, string, eltstring, bestmatch); |
| 1390 | tem = type == 3 | 1393 | tem = type == 3 |
| 1391 | ? call2 (predicate, elt, | 1394 | ? call2 (predicate, elt, |
| 1392 | HASH_VALUE (XHASH_TABLE (alist), index - 1)) | 1395 | HASH_VALUE (XHASH_TABLE (collection), index - 1)) |
| 1393 | : call1 (predicate, elt); | 1396 | : call1 (predicate, elt); |
| 1394 | UNGCPRO; | 1397 | UNGCPRO; |
| 1395 | } | 1398 | } |
| @@ -1498,19 +1501,22 @@ is used to further constrain the set of candidates. */) | |||
| 1498 | } | 1501 | } |
| 1499 | 1502 | ||
| 1500 | DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 4, 0, | 1503 | DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 4, 0, |
| 1501 | doc: /* Search for partial matches to STRING in ALIST. | 1504 | doc: /* Search for partial matches to STRING in COLLECTION. |
| 1502 | Each car of each element of ALIST (or each element if it is not a cons cell) | 1505 | Test each of the possible completions specified by COLLECTION |
| 1503 | is tested to see if it begins with STRING. The possible matches may be | 1506 | to see if it begins with STRING. The possible completions may be |
| 1504 | strings or symbols. Symbols are converted to strings before testing, | 1507 | strings or symbols. Symbols are converted to strings before testing, |
| 1505 | see `symbol-name'. | 1508 | see `symbol-name'. |
| 1506 | The value is a list of all the strings from ALIST that match. | 1509 | The value is a list of all the possible completions that match STRING. |
| 1507 | 1510 | ||
| 1508 | If ALIST is a hash-table, all the string and symbol keys are the | 1511 | If COLLECTION is an alist, the keys (cars of elements) are the |
| 1509 | possible matches. | 1512 | possible completions. If an element is not a cons cell, then the |
| 1510 | If ALIST is an obarray, the names of all symbols in the obarray | 1513 | element itself is the possible completion. |
| 1511 | are the possible matches. | 1514 | If COLLECTION is a hash-table, all the keys that are strings or symbols |
| 1515 | are the possible completions. | ||
| 1516 | If COLLECTION is an obarray, the names of all symbols in the obarray | ||
| 1517 | are the possible completions. | ||
| 1512 | 1518 | ||
| 1513 | ALIST can also be a function to do the completion itself. | 1519 | COLLECTION can also be a function to do the completion itself. |
| 1514 | It receives three arguments: the values STRING, PREDICATE and t. | 1520 | It receives three arguments: the values STRING, PREDICATE and t. |
| 1515 | Whatever it returns becomes the value of `all-completions'. | 1521 | Whatever it returns becomes the value of `all-completions'. |
| 1516 | 1522 | ||
| @@ -1518,24 +1524,24 @@ If optional third argument PREDICATE is non-nil, | |||
| 1518 | it is used to test each possible match. | 1524 | it is used to test each possible match. |
| 1519 | The match is a candidate only if PREDICATE returns non-nil. | 1525 | The match is a candidate only if PREDICATE returns non-nil. |
| 1520 | The argument given to PREDICATE is the alist element | 1526 | The argument given to PREDICATE is the alist element |
| 1521 | or the symbol from the obarray. If ALIST is a hash-table, | 1527 | or the symbol from the obarray. If COLLECTION is a hash-table, |
| 1522 | predicate is called with two arguments: the key and the value. | 1528 | predicate is called with two arguments: the key and the value. |
| 1523 | Additionally to this predicate, `completion-regexp-list' | 1529 | Additionally to this predicate, `completion-regexp-list' |
| 1524 | is used to further constrain the set of candidates. | 1530 | is used to further constrain the set of candidates. |
| 1525 | 1531 | ||
| 1526 | If the optional fourth argument HIDE-SPACES is non-nil, | 1532 | If the optional fourth argument HIDE-SPACES is non-nil, |
| 1527 | strings in ALIST that start with a space | 1533 | strings in COLLECTION that start with a space |
| 1528 | are ignored unless STRING itself starts with a space. */) | 1534 | are ignored unless STRING itself starts with a space. */) |
| 1529 | (string, alist, predicate, hide_spaces) | 1535 | (string, collection, predicate, hide_spaces) |
| 1530 | Lisp_Object string, alist, predicate, hide_spaces; | 1536 | Lisp_Object string, collection, predicate, hide_spaces; |
| 1531 | { | 1537 | { |
| 1532 | Lisp_Object tail, elt, eltstring; | 1538 | Lisp_Object tail, elt, eltstring; |
| 1533 | Lisp_Object allmatches; | 1539 | Lisp_Object allmatches; |
| 1534 | int type = HASH_TABLE_P (alist) ? 3 | 1540 | int type = HASH_TABLE_P (collection) ? 3 |
| 1535 | : VECTORP (alist) ? 2 | 1541 | : VECTORP (collection) ? 2 |
| 1536 | : NILP (alist) || (CONSP (alist) | 1542 | : NILP (collection) || (CONSP (collection) |
| 1537 | && (!SYMBOLP (XCAR (alist)) | 1543 | && (!SYMBOLP (XCAR (collection)) |
| 1538 | || NILP (XCAR (alist)))); | 1544 | || NILP (XCAR (collection)))); |
| 1539 | int index = 0, obsize = 0; | 1545 | int index = 0, obsize = 0; |
| 1540 | int bindcount = -1; | 1546 | int bindcount = -1; |
| 1541 | Lisp_Object bucket, tem, zero; | 1547 | Lisp_Object bucket, tem, zero; |
| @@ -1543,16 +1549,16 @@ are ignored unless STRING itself starts with a space. */) | |||
| 1543 | 1549 | ||
| 1544 | CHECK_STRING (string); | 1550 | CHECK_STRING (string); |
| 1545 | if (type == 0) | 1551 | if (type == 0) |
| 1546 | return call3 (alist, string, predicate, Qt); | 1552 | return call3 (collection, string, predicate, Qt); |
| 1547 | allmatches = bucket = Qnil; | 1553 | allmatches = bucket = Qnil; |
| 1548 | zero = make_number (0); | 1554 | zero = make_number (0); |
| 1549 | 1555 | ||
| 1550 | /* If ALIST is not a list, set TAIL just for gc pro. */ | 1556 | /* If COLLECTION is not a list, set TAIL just for gc pro. */ |
| 1551 | tail = alist; | 1557 | tail = collection; |
| 1552 | if (type == 2) | 1558 | if (type == 2) |
| 1553 | { | 1559 | { |
| 1554 | obsize = XVECTOR (alist)->size; | 1560 | obsize = XVECTOR (collection)->size; |
| 1555 | bucket = XVECTOR (alist)->contents[index]; | 1561 | bucket = XVECTOR (collection)->contents[index]; |
| 1556 | } | 1562 | } |
| 1557 | 1563 | ||
| 1558 | while (1) | 1564 | while (1) |
| @@ -1585,19 +1591,19 @@ are ignored unless STRING itself starts with a space. */) | |||
| 1585 | break; | 1591 | break; |
| 1586 | else | 1592 | else |
| 1587 | { | 1593 | { |
| 1588 | bucket = XVECTOR (alist)->contents[index]; | 1594 | bucket = XVECTOR (collection)->contents[index]; |
| 1589 | continue; | 1595 | continue; |
| 1590 | } | 1596 | } |
| 1591 | } | 1597 | } |
| 1592 | else /* if (type == 3) */ | 1598 | else /* if (type == 3) */ |
| 1593 | { | 1599 | { |
| 1594 | while (index < HASH_TABLE_SIZE (XHASH_TABLE (alist)) | 1600 | while (index < HASH_TABLE_SIZE (XHASH_TABLE (collection)) |
| 1595 | && NILP (HASH_HASH (XHASH_TABLE (alist), index))) | 1601 | && NILP (HASH_HASH (XHASH_TABLE (collection), index))) |
| 1596 | index++; | 1602 | index++; |
| 1597 | if (index >= HASH_TABLE_SIZE (XHASH_TABLE (alist))) | 1603 | if (index >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) |
| 1598 | break; | 1604 | break; |
| 1599 | else | 1605 | else |
| 1600 | elt = eltstring = HASH_KEY (XHASH_TABLE (alist), index++); | 1606 | elt = eltstring = HASH_KEY (XHASH_TABLE (collection), index++); |
| 1601 | } | 1607 | } |
| 1602 | 1608 | ||
| 1603 | /* Is this element a possible completion? */ | 1609 | /* Is this element a possible completion? */ |
| @@ -1659,7 +1665,7 @@ are ignored unless STRING itself starts with a space. */) | |||
| 1659 | GCPRO4 (tail, eltstring, allmatches, string); | 1665 | GCPRO4 (tail, eltstring, allmatches, string); |
| 1660 | tem = type == 3 | 1666 | tem = type == 3 |
| 1661 | ? call2 (predicate, elt, | 1667 | ? call2 (predicate, elt, |
| 1662 | HASH_VALUE (XHASH_TABLE (alist), index - 1)) | 1668 | HASH_VALUE (XHASH_TABLE (collection), index - 1)) |
| 1663 | : call1 (predicate, elt); | 1669 | : call1 (predicate, elt); |
| 1664 | UNGCPRO; | 1670 | UNGCPRO; |
| 1665 | } | 1671 | } |
| @@ -1686,19 +1692,14 @@ Lisp_Object Vminibuffer_completing_file_name; | |||
| 1686 | DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0, | 1692 | DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0, |
| 1687 | doc: /* Read a string in the minibuffer, with completion. | 1693 | doc: /* Read a string in the minibuffer, with completion. |
| 1688 | PROMPT is a string to prompt with; normally it ends in a colon and a space. | 1694 | PROMPT is a string to prompt with; normally it ends in a colon and a space. |
| 1689 | 1695 | COLLECTION can be a list of strings, an alist, an obarray or a hash table. | |
| 1690 | TABLE can be a list of strings, an alist, an obarray or a hash table; their | 1696 | COLLECTION can also be a function to do the completion itself. |
| 1691 | elements are tested to see if they begin with STRING. | 1697 | PREDICATE limits completion to a subset of COLLECTION. |
| 1692 | TABLE can also be a function to do the completion itself; it receives | ||
| 1693 | three arguments: the values STRING, PREDICATE and nil. | ||
| 1694 | Whatever it returns becomes the value of `try-completion'. | ||
| 1695 | |||
| 1696 | PREDICATE limits completion to a subset of TABLE. | ||
| 1697 | See `try-completion' and `all-completions' for more details | 1698 | See `try-completion' and `all-completions' for more details |
| 1698 | on completion, TABLE (called "alist" there), and PREDICATE. | 1699 | on completion, COLLECTION, and PREDICATE. |
| 1699 | 1700 | ||
| 1700 | If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless | 1701 | If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless |
| 1701 | the input is (or completes to) an element of TABLE or is null. | 1702 | the input is (or completes to) an element of COLLECTION or is null. |
| 1702 | If it is also not t, typing RET does not exit if it does non-null completion. | 1703 | If it is also not t, typing RET does not exit if it does non-null completion. |
| 1703 | If the input is null, `completing-read' returns DEF, or an empty string | 1704 | If the input is null, `completing-read' returns DEF, or an empty string |
| 1704 | if DEF is nil, regardless of the value of REQUIRE-MATCH. | 1705 | if DEF is nil, regardless of the value of REQUIRE-MATCH. |
| @@ -1732,8 +1733,8 @@ If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits | |||
| 1732 | 1733 | ||
| 1733 | Completion ignores case if the ambient value of | 1734 | Completion ignores case if the ambient value of |
| 1734 | `completion-ignore-case' is non-nil. */) | 1735 | `completion-ignore-case' is non-nil. */) |
| 1735 | (prompt, table, predicate, require_match, initial_input, hist, def, inherit_input_method) | 1736 | (prompt, collection, predicate, require_match, initial_input, hist, def, inherit_input_method) |
| 1736 | Lisp_Object prompt, table, predicate, require_match, initial_input; | 1737 | Lisp_Object prompt, collection, predicate, require_match, initial_input; |
| 1737 | Lisp_Object hist, def, inherit_input_method; | 1738 | Lisp_Object hist, def, inherit_input_method; |
| 1738 | { | 1739 | { |
| 1739 | Lisp_Object val, histvar, histpos, position; | 1740 | Lisp_Object val, histvar, histpos, position; |
| @@ -1745,7 +1746,7 @@ Completion ignores case if the ambient value of | |||
| 1745 | init = initial_input; | 1746 | init = initial_input; |
| 1746 | GCPRO1 (def); | 1747 | GCPRO1 (def); |
| 1747 | 1748 | ||
| 1748 | specbind (Qminibuffer_completion_table, table); | 1749 | specbind (Qminibuffer_completion_table, collection); |
| 1749 | specbind (Qminibuffer_completion_predicate, predicate); | 1750 | specbind (Qminibuffer_completion_predicate, predicate); |
| 1750 | specbind (Qminibuffer_completion_confirm, | 1751 | specbind (Qminibuffer_completion_confirm, |
| 1751 | EQ (require_match, Qt) ? Qnil : require_match); | 1752 | EQ (require_match, Qt) ? Qnil : require_match); |
| @@ -1807,27 +1808,28 @@ Lisp_Object Fassoc_string (); | |||
| 1807 | DEFUN ("test-completion", Ftest_completion, Stest_completion, 2, 3, 0, | 1808 | DEFUN ("test-completion", Ftest_completion, Stest_completion, 2, 3, 0, |
| 1808 | doc: /* Return non-nil if STRING is a valid completion. | 1809 | doc: /* Return non-nil if STRING is a valid completion. |
| 1809 | Takes the same arguments as `all-completions' and `try-completion'. | 1810 | Takes the same arguments as `all-completions' and `try-completion'. |
| 1810 | If ALIST is a function, it is called with three arguments: | 1811 | If COLLECTION is a function, it is called with three arguments: |
| 1811 | the values STRING, PREDICATE and `lambda'. */) | 1812 | the values STRING, PREDICATE and `lambda'. */) |
| 1812 | (string, alist, predicate) | 1813 | (string, collection, predicate) |
| 1813 | Lisp_Object string, alist, predicate; | 1814 | Lisp_Object string, collection, predicate; |
| 1814 | { | 1815 | { |
| 1815 | Lisp_Object regexps, tail, tem = Qnil; | 1816 | Lisp_Object regexps, tail, tem = Qnil; |
| 1816 | int i = 0; | 1817 | int i = 0; |
| 1817 | 1818 | ||
| 1818 | CHECK_STRING (string); | 1819 | CHECK_STRING (string); |
| 1819 | 1820 | ||
| 1820 | if ((CONSP (alist) && (!SYMBOLP (XCAR (alist)) || NILP (XCAR (alist)))) | 1821 | if ((CONSP (collection) |
| 1821 | || NILP (alist)) | 1822 | && (!SYMBOLP (XCAR (collection)) || NILP (XCAR (collection)))) |
| 1823 | || NILP (collection)) | ||
| 1822 | { | 1824 | { |
| 1823 | tem = Fassoc_string (string, alist, completion_ignore_case ? Qt : Qnil); | 1825 | tem = Fassoc_string (string, collection, completion_ignore_case ? Qt : Qnil); |
| 1824 | if (NILP (tem)) | 1826 | if (NILP (tem)) |
| 1825 | return Qnil; | 1827 | return Qnil; |
| 1826 | } | 1828 | } |
| 1827 | else if (VECTORP (alist)) | 1829 | else if (VECTORP (collection)) |
| 1828 | { | 1830 | { |
| 1829 | /* Bypass intern-soft as that loses for nil. */ | 1831 | /* Bypass intern-soft as that loses for nil. */ |
| 1830 | tem = oblookup (alist, | 1832 | tem = oblookup (collection, |
| 1831 | SDATA (string), | 1833 | SDATA (string), |
| 1832 | SCHARS (string), | 1834 | SCHARS (string), |
| 1833 | SBYTES (string)); | 1835 | SBYTES (string)); |
| @@ -1838,7 +1840,7 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1838 | else | 1840 | else |
| 1839 | string = Fstring_make_multibyte (string); | 1841 | string = Fstring_make_multibyte (string); |
| 1840 | 1842 | ||
| 1841 | tem = oblookup (alist, | 1843 | tem = oblookup (collection, |
| 1842 | SDATA (string), | 1844 | SDATA (string), |
| 1843 | SCHARS (string), | 1845 | SCHARS (string), |
| 1844 | SBYTES (string)); | 1846 | SBYTES (string)); |
| @@ -1846,9 +1848,9 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1846 | 1848 | ||
| 1847 | if (completion_ignore_case && !SYMBOLP (tem)) | 1849 | if (completion_ignore_case && !SYMBOLP (tem)) |
| 1848 | { | 1850 | { |
| 1849 | for (i = XVECTOR (alist)->size - 1; i >= 0; i--) | 1851 | for (i = XVECTOR (collection)->size - 1; i >= 0; i--) |
| 1850 | { | 1852 | { |
| 1851 | tail = XVECTOR (alist)->contents[i]; | 1853 | tail = XVECTOR (collection)->contents[i]; |
| 1852 | if (SYMBOLP (tail)) | 1854 | if (SYMBOLP (tail)) |
| 1853 | while (1) | 1855 | while (1) |
| 1854 | { | 1856 | { |
| @@ -1870,9 +1872,9 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1870 | if (!SYMBOLP (tem)) | 1872 | if (!SYMBOLP (tem)) |
| 1871 | return Qnil; | 1873 | return Qnil; |
| 1872 | } | 1874 | } |
| 1873 | else if (HASH_TABLE_P (alist)) | 1875 | else if (HASH_TABLE_P (collection)) |
| 1874 | { | 1876 | { |
| 1875 | struct Lisp_Hash_Table *h = XHASH_TABLE (alist); | 1877 | struct Lisp_Hash_Table *h = XHASH_TABLE (collection); |
| 1876 | i = hash_lookup (h, string, NULL); | 1878 | i = hash_lookup (h, string, NULL); |
| 1877 | if (i >= 0) | 1879 | if (i >= 0) |
| 1878 | tem = HASH_KEY (h, i); | 1880 | tem = HASH_KEY (h, i); |
| @@ -1891,7 +1893,7 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1891 | return Qnil; | 1893 | return Qnil; |
| 1892 | } | 1894 | } |
| 1893 | else | 1895 | else |
| 1894 | return call3 (alist, string, predicate, Qlambda); | 1896 | return call3 (collection, string, predicate, Qlambda); |
| 1895 | 1897 | ||
| 1896 | /* Reject this element if it fails to match all the regexps. */ | 1898 | /* Reject this element if it fails to match all the regexps. */ |
| 1897 | if (CONSP (Vcompletion_regexp_list)) | 1899 | if (CONSP (Vcompletion_regexp_list)) |
| @@ -1912,8 +1914,8 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1912 | /* Finally, check the predicate. */ | 1914 | /* Finally, check the predicate. */ |
| 1913 | if (!NILP (predicate)) | 1915 | if (!NILP (predicate)) |
| 1914 | { | 1916 | { |
| 1915 | return HASH_TABLE_P (alist) | 1917 | return HASH_TABLE_P (collection) |
| 1916 | ? call2 (predicate, tem, HASH_VALUE (XHASH_TABLE (alist), i)) | 1918 | ? call2 (predicate, tem, HASH_VALUE (XHASH_TABLE (collection), i)) |
| 1917 | : call1 (predicate, tem); | 1919 | : call1 (predicate, tem); |
| 1918 | } | 1920 | } |
| 1919 | else | 1921 | else |