diff 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
line wrap: on
line diff
--- a/src/minibuf.c	Fri Feb 18 00:41:50 2005 +0000
+++ b/src/minibuf.c	Wed Feb 23 09:18:23 2005 +0000
@@ -1181,13 +1181,16 @@
 DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0,
        doc: /* Return common substring of all completions of STRING in ALIST.
 Each car of each element of ALIST (or each element if it is not a cons cell)
-is tested to see if it begins with STRING.
+is tested to see if it begins with STRING.  The possible matches may be
+strings or symbols.  Symbols are converted to strings before testing,
+see `symbol-name'.
 All that match are compared together; the longest initial sequence
 common to all matches is returned as a string.
 If there is no match at all, nil is returned.
 For a unique match which is exact, t is returned.
 
-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
+possible matches.
 If ALIST is an obarray, the names of all symbols in the obarray
 are the possible matches.
 
@@ -1257,7 +1260,7 @@
 	  if (!EQ (bucket, zero))
 	    {
 	      elt = bucket;
-	      eltstring = Fsymbol_name (elt);
+	      eltstring = elt;
 	      if (XSYMBOL (bucket)->next)
 		XSETSYMBOL (bucket, XSYMBOL (bucket)->next);
 	      else
@@ -1284,6 +1287,9 @@
 
       /* Is this element a possible completion? */
 
+      if (SYMBOLP (eltstring))
+	eltstring = Fsymbol_name (eltstring);
+
       if (STRINGP (eltstring)
 	  && SCHARS (string) <= SCHARS (eltstring)
 	  && (tem = Fcompare_strings (eltstring, zero,
@@ -1440,10 +1446,13 @@
 DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 4, 0,
        doc: /* Search for partial matches to STRING in ALIST.
 Each car of each element of ALIST (or each element if it is not a cons cell)
-is tested to see if it begins with STRING.
+is tested to see if it begins with STRING.  The possible matches may be
+strings or symbols.  Symbols are converted to strings before testing,
+see `symbol-name'.
 The value is a list of all the strings from ALIST that match.
 
-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
+possible matches.
 If ALIST is an obarray, the names of all symbols in the obarray
 are the possible matches.
 
@@ -1512,7 +1521,7 @@
 	  if (!EQ (bucket, zero))
 	    {
 	      elt = bucket;
-	      eltstring = Fsymbol_name (elt);
+	      eltstring = elt;
 	      if (XSYMBOL (bucket)->next)
 		XSETSYMBOL (bucket, XSYMBOL (bucket)->next);
 	      else
@@ -1539,6 +1548,9 @@
 
       /* Is this element a possible completion? */
 
+      if (SYMBOLP (eltstring))
+	eltstring = Fsymbol_name (eltstring);
+
       if (STRINGP (eltstring)
 	  && SCHARS (string) <= SCHARS (eltstring)
 	  /* If HIDE_SPACES, reject alternatives that start with space