]> git.eshelyaron.com Git - emacs.git/commitdiff
(assoc_no_quit): New function.
authorKenichi Handa <handa@m17n.org>
Tue, 6 Jun 2006 03:51:12 +0000 (03:51 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 6 Jun 2006 03:51:12 +0000 (03:51 +0000)
src/fns.c

index 2d4c49fbaa293a7bdf8ff93545ea90f7ec77514b..545b4d7b0ea4cddd9deb4611139042d5e6595598 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -1524,6 +1524,22 @@ The value is actually the first element of LIST whose car equals KEY.  */)
   return result;
 }
 
+/* Like Fassoc but never report an error and do not allow quits.
+   Use only on lists known never to be circular.  */
+
+Lisp_Object
+assoc_no_quit (key, list)
+     Lisp_Object key, list;
+{
+  while (CONSP (list)
+        && (!CONSP (XCAR (list))
+            || (!EQ (XCAR (XCAR (list)), key)
+                && NILP (Fequal (XCAR (XCAR (list)), key)))))
+    list = XCDR (list);
+
+  return CONSP (list) ? XCAR (list) : Qnil;
+}
+
 DEFUN ("rassq", Frassq, Srassq, 2, 2, 0,
        doc: /* Return non-nil if KEY is `eq' to the cdr of an element of LIST.
 The value is actually the first element of LIST whose cdr is KEY.  */)