diff src/minibuf.c @ 4704:44c9d1005ce2

Bring `try-completion''s interface closer to GNU Emacs. 2009-09-29 Mike Sperber <mike@xemacs.org> * minibuf.c (Ftry_completion): If the collection is a list, allow plain elements instead of cons cells. (As in GNU Emacs.)
author Mike Sperber <sperber@deinprogramm.de>
date Wed, 30 Sep 2009 21:15:04 +0200
parents ecf1ebac70d8
children 6ef8256a020a 19a72041c5ed
line wrap: on
line diff
--- a/src/minibuf.c	Wed Sep 30 12:48:21 2009 +0100
+++ b/src/minibuf.c	Wed Sep 30 21:15:04 2009 +0200
@@ -310,8 +310,9 @@
 common to all matches is returned as a string.  If there is no match
 at all, nil is returned.  For an exact match, t is returned.
 
-If COLLECTION is an alist, the cars of the elements of the alist
-\(which must be strings) form the set of possible completions.
+If COLLECTION is list, the elements of the list that are not cons
+cells and the cars of the elements of the list that are cons cells
+(which must be strings) form the set of possible completions.
 
 If COLLECTION is an obarray, the names of all symbols in the obarray
 are the possible completions.
@@ -385,7 +386,10 @@
 	  if (NILP (tail))
 	    break;
 	  elt = Fcar (tail);
-	  eltstring = Fcar (elt);
+	  if (CONSP (elt))
+	    eltstring = Fcar (elt);
+	  else
+	    eltstring = elt;
 	  tail = Fcdr (tail);
 	}
       else