1181 |
DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0, |
DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0, |
1182 |
doc: /* Return common substring of all completions of STRING in ALIST. |
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) |
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. |
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'. |
1187 |
All that match are compared together; the longest initial sequence |
All that match are compared together; the longest initial sequence |
1188 |
common to all matches is returned as a string. |
common to all matches is returned as a string. |
1189 |
If there is no match at all, nil is returned. |
If there is no match at all, nil is returned. |
1190 |
For a unique match which is exact, t is returned. |
For a unique match which is exact, t is returned. |
1191 |
|
|
1192 |
If ALIST is a hash-table, all the string keys are the possible matches. |
If ALIST is a hash-table, all the string and symbol keys are the |
1193 |
|
possible matches. |
1194 |
If ALIST is an obarray, the names of all symbols in the obarray |
If ALIST is an obarray, the names of all symbols in the obarray |
1195 |
are the possible matches. |
are the possible matches. |
1196 |
|
|
1260 |
if (!EQ (bucket, zero)) |
if (!EQ (bucket, zero)) |
1261 |
{ |
{ |
1262 |
elt = bucket; |
elt = bucket; |
1263 |
eltstring = Fsymbol_name (elt); |
eltstring = elt; |
1264 |
if (XSYMBOL (bucket)->next) |
if (XSYMBOL (bucket)->next) |
1265 |
XSETSYMBOL (bucket, XSYMBOL (bucket)->next); |
XSETSYMBOL (bucket, XSYMBOL (bucket)->next); |
1266 |
else |
else |
1287 |
|
|
1288 |
/* Is this element a possible completion? */ |
/* Is this element a possible completion? */ |
1289 |
|
|
1290 |
|
if (SYMBOLP (eltstring)) |
1291 |
|
eltstring = Fsymbol_name (eltstring); |
1292 |
|
|
1293 |
if (STRINGP (eltstring) |
if (STRINGP (eltstring) |
1294 |
&& SCHARS (string) <= SCHARS (eltstring) |
&& SCHARS (string) <= SCHARS (eltstring) |
1295 |
&& (tem = Fcompare_strings (eltstring, zero, |
&& (tem = Fcompare_strings (eltstring, zero, |
1446 |
DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 4, 0, |
DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 4, 0, |
1447 |
doc: /* Search for partial matches to STRING in ALIST. |
doc: /* Search for partial matches to STRING in ALIST. |
1448 |
Each car of each element of ALIST (or each element if it is not a cons cell) |
Each car of each element of ALIST (or each element if it is not a cons cell) |
1449 |
is tested to see if it begins with STRING. |
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'. |
1452 |
The value is a list of all the strings from ALIST that match. |
The value is a list of all the strings from ALIST that match. |
1453 |
|
|
1454 |
If ALIST is a hash-table, all the string keys are the possible matches. |
If ALIST is a hash-table, all the string and symbol keys are the |
1455 |
|
possible matches. |
1456 |
If ALIST is an obarray, the names of all symbols in the obarray |
If ALIST is an obarray, the names of all symbols in the obarray |
1457 |
are the possible matches. |
are the possible matches. |
1458 |
|
|
1521 |
if (!EQ (bucket, zero)) |
if (!EQ (bucket, zero)) |
1522 |
{ |
{ |
1523 |
elt = bucket; |
elt = bucket; |
1524 |
eltstring = Fsymbol_name (elt); |
eltstring = elt; |
1525 |
if (XSYMBOL (bucket)->next) |
if (XSYMBOL (bucket)->next) |
1526 |
XSETSYMBOL (bucket, XSYMBOL (bucket)->next); |
XSETSYMBOL (bucket, XSYMBOL (bucket)->next); |
1527 |
else |
else |
1548 |
|
|
1549 |
/* Is this element a possible completion? */ |
/* Is this element a possible completion? */ |
1550 |
|
|
1551 |
|
if (SYMBOLP (eltstring)) |
1552 |
|
eltstring = Fsymbol_name (eltstring); |
1553 |
|
|
1554 |
if (STRINGP (eltstring) |
if (STRINGP (eltstring) |
1555 |
&& SCHARS (string) <= SCHARS (eltstring) |
&& SCHARS (string) <= SCHARS (eltstring) |
1556 |
/* If HIDE_SPACES, reject alternatives that start with space |
/* If HIDE_SPACES, reject alternatives that start with space |