]> code.delx.au - gnu-emacs/blobdiff - src/minibuf.c
Merge from emacs--devo--0
[gnu-emacs] / src / minibuf.c
index c92bb5e461605c496665f7e2d85afc35753b0bf9..14f5eac846a4709b680e3484197c1e0b343cebf7 100644 (file)
@@ -2073,9 +2073,10 @@ do_completion ()
 /* Like assoc but assumes KEY is a string, and ignores case if appropriate.  */
 
 DEFUN ("assoc-string", Fassoc_string, Sassoc_string, 2, 3, 0,
-       doc: /* Like `assoc' but specifically for strings.
-Unibyte strings are converted to multibyte for comparison.
-And case is ignored if CASE-FOLD is non-nil.
+       doc: /* Like `assoc' but specifically for strings (and symbols).
+Symbols are converted to strings, and unibyte strings are converted to
+multibyte for comparison.
+Case is ignored if optional arg CASE-FOLD is non-nil.
 As opposed to `assoc', it will also match an entry consisting of a single
 string rather than a cons cell whose car is a string.  */)
        (key, list, case_fold)
@@ -2084,12 +2085,17 @@ string rather than a cons cell whose car is a string.  */)
 {
   register Lisp_Object tail;
 
+  if (SYMBOLP (key))
+    key = Fsymbol_name (key);
+
   for (tail = list; !NILP (tail); tail = Fcdr (tail))
     {
       register Lisp_Object elt, tem, thiscar;
       elt = Fcar (tail);
       thiscar = CONSP (elt) ? XCAR (elt) : elt;
-      if (!STRINGP (thiscar))
+      if (SYMBOLP (thiscar))
+       thiscar = Fsymbol_name (thiscar);
+      else if (!STRINGP (thiscar))
        continue;
       tem = Fcompare_strings (thiscar, make_number (0), Qnil,
                              key, make_number (0), Qnil,