comparison src/minibuf.c @ 90106:bf0d492ea2d5

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-16 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-106 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-110 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-111 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-112 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-113 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-114 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-115 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-123 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-124 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-17 - miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-19 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-20 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-21 More work on moving images to etc/images * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-22 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-23 Fix errors with image-file installation * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-24 etc/Makefile.in (install): Put gnus-tut.txt in the right place. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-25 etc/Makefile.in (install, uninstall): Fix installed image dirs. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-26 etc/Makefile.in (install): Create $(etcdir)/images/gnus dir. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-27 Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 23 Feb 2005 09:18:23 +0000
parents fb79180b618d 469c72af5168
children 4da4a09e8b1b
comparison
equal deleted inserted replaced
90105:7e3f621f1dd4 90106:bf0d492ea2d5
1179 } 1179 }
1180 1180
1181 DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0, 1181 DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0,
1182 doc: /* Return common substring of all completions of STRING in ALIST. 1182 doc: /* Return common substring of all completions of STRING in ALIST.
1183 Each car of each element of ALIST (or each element if it is not a cons cell) 1183 Each car of each element of ALIST (or each element if it is not a cons cell)
1184 is tested to see if it begins with STRING. 1184 is tested to see if it begins with STRING. The possible matches may be
1185 strings or symbols. Symbols are converted to strings before testing,
1186 see `symbol-name'.
1185 All that match are compared together; the longest initial sequence 1187 All that match are compared together; the longest initial sequence
1186 common to all matches is returned as a string. 1188 common to all matches is returned as a string.
1187 If there is no match at all, nil is returned. 1189 If there is no match at all, nil is returned.
1188 For a unique match which is exact, t is returned. 1190 For a unique match which is exact, t is returned.
1189 1191
1190 If ALIST is a hash-table, all the string keys are the possible matches. 1192 If ALIST is a hash-table, all the string and symbol keys are the
1193 possible matches.
1191 If ALIST is an obarray, the names of all symbols in the obarray 1194 If ALIST is an obarray, the names of all symbols in the obarray
1192 are the possible matches. 1195 are the possible matches.
1193 1196
1194 ALIST can also be a function to do the completion itself. 1197 ALIST can also be a function to do the completion itself.
1195 It receives three arguments: the values STRING, PREDICATE and nil. 1198 It receives three arguments: the values STRING, PREDICATE and nil.
1255 else if (type == 2) 1258 else if (type == 2)
1256 { 1259 {
1257 if (!EQ (bucket, zero)) 1260 if (!EQ (bucket, zero))
1258 { 1261 {
1259 elt = bucket; 1262 elt = bucket;
1260 eltstring = Fsymbol_name (elt); 1263 eltstring = elt;
1261 if (XSYMBOL (bucket)->next) 1264 if (XSYMBOL (bucket)->next)
1262 XSETSYMBOL (bucket, XSYMBOL (bucket)->next); 1265 XSETSYMBOL (bucket, XSYMBOL (bucket)->next);
1263 else 1266 else
1264 XSETFASTINT (bucket, 0); 1267 XSETFASTINT (bucket, 0);
1265 } 1268 }
1281 else 1284 else
1282 elt = eltstring = HASH_KEY (XHASH_TABLE (alist), index++); 1285 elt = eltstring = HASH_KEY (XHASH_TABLE (alist), index++);
1283 } 1286 }
1284 1287
1285 /* Is this element a possible completion? */ 1288 /* Is this element a possible completion? */
1289
1290 if (SYMBOLP (eltstring))
1291 eltstring = Fsymbol_name (eltstring);
1286 1292
1287 if (STRINGP (eltstring) 1293 if (STRINGP (eltstring)
1288 && SCHARS (string) <= SCHARS (eltstring) 1294 && SCHARS (string) <= SCHARS (eltstring)
1289 && (tem = Fcompare_strings (eltstring, zero, 1295 && (tem = Fcompare_strings (eltstring, zero,
1290 make_number (SCHARS (string)), 1296 make_number (SCHARS (string)),
1438 } 1444 }
1439 1445
1440 DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 4, 0, 1446 DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 4, 0,
1441 doc: /* Search for partial matches to STRING in ALIST. 1447 doc: /* Search for partial matches to STRING in ALIST.
1442 Each car of each element of ALIST (or each element if it is not a cons cell) 1448 Each car of each element of ALIST (or each element if it is not a cons cell)
1443 is tested to see if it begins with STRING. 1449 is tested to see if it begins with STRING. The possible matches may be
1450 strings or symbols. Symbols are converted to strings before testing,
1451 see `symbol-name'.
1444 The value is a list of all the strings from ALIST that match. 1452 The value is a list of all the strings from ALIST that match.
1445 1453
1446 If ALIST is a hash-table, all the string keys are the possible matches. 1454 If ALIST is a hash-table, all the string and symbol keys are the
1455 possible matches.
1447 If ALIST is an obarray, the names of all symbols in the obarray 1456 If ALIST is an obarray, the names of all symbols in the obarray
1448 are the possible matches. 1457 are the possible matches.
1449 1458
1450 ALIST can also be a function to do the completion itself. 1459 ALIST can also be a function to do the completion itself.
1451 It receives three arguments: the values STRING, PREDICATE and t. 1460 It receives three arguments: the values STRING, PREDICATE and t.
1510 else if (type == 2) 1519 else if (type == 2)
1511 { 1520 {
1512 if (!EQ (bucket, zero)) 1521 if (!EQ (bucket, zero))
1513 { 1522 {
1514 elt = bucket; 1523 elt = bucket;
1515 eltstring = Fsymbol_name (elt); 1524 eltstring = elt;
1516 if (XSYMBOL (bucket)->next) 1525 if (XSYMBOL (bucket)->next)
1517 XSETSYMBOL (bucket, XSYMBOL (bucket)->next); 1526 XSETSYMBOL (bucket, XSYMBOL (bucket)->next);
1518 else 1527 else
1519 XSETFASTINT (bucket, 0); 1528 XSETFASTINT (bucket, 0);
1520 } 1529 }
1536 else 1545 else
1537 elt = eltstring = HASH_KEY (XHASH_TABLE (alist), index++); 1546 elt = eltstring = HASH_KEY (XHASH_TABLE (alist), index++);
1538 } 1547 }
1539 1548
1540 /* Is this element a possible completion? */ 1549 /* Is this element a possible completion? */
1550
1551 if (SYMBOLP (eltstring))
1552 eltstring = Fsymbol_name (eltstring);
1541 1553
1542 if (STRINGP (eltstring) 1554 if (STRINGP (eltstring)
1543 && SCHARS (string) <= SCHARS (eltstring) 1555 && SCHARS (string) <= SCHARS (eltstring)
1544 /* If HIDE_SPACES, reject alternatives that start with space 1556 /* If HIDE_SPACES, reject alternatives that start with space
1545 unless the input starts with space. */ 1557 unless the input starts with space. */