changeset 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 6dfca4f26f53
children 7b90173970ad
files src/ChangeLog src/minibuf.c
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Sep 30 12:48:21 2009 +0100
+++ b/src/ChangeLog	Wed Sep 30 21:15:04 2009 +0200
@@ -5,6 +5,11 @@
 	Delius Royar. Though it's unclear why, I'll try to investigate
 	once I'm on a 32-bit Unix machine regularly again.
 
+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.)
+
 2009-09-23  Stephen Turnbull  <stephen@xemacs.org>
 
 	* glyphs-eimage.c (png_instantiate):
--- 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