From: Richard M. Stallman Date: Tue, 11 Jan 1994 07:22:11 +0000 (+0000) Subject: (Fcondition_case): Allow a list of condition names in a handler. X-Git-Tag: emacs-19.34~10288 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5f96776a9747052106b034045f5632d802ae4e77;p=emacs.git (Fcondition_case): Allow a list of condition names in a handler. (find_handler_clause): Likewise. --- diff --git a/src/eval.c b/src/eval.c index 1a5fc45004f..5f72b7a07c2 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1013,8 +1013,10 @@ See also the function `signal' for more info.") { Lisp_Object tem; tem = Fcar (val); - if ((!NILP (tem)) && - (!CONSP (tem) || (XTYPE (XCONS (tem)->car) != Lisp_Symbol))) + if (! (NILP (tem) + || (CONSP (tem) + && (SYMBOLP (XCONS (tem)->car) + || CONSP (XCONS (tem)->car))))) error ("Invalid condition handler", tem); } @@ -1195,7 +1197,6 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) { register Lisp_Object h; register Lisp_Object tem; - register Lisp_Object tem1; if (EQ (handlers, Qt)) /* t is used by handlers for all conditions, set up by C code. */ return Qt; @@ -1220,12 +1221,30 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) } for (h = handlers; CONSP (h); h = Fcdr (h)) { - tem1 = Fcar (h); - if (!CONSP (tem1)) + Lisp_Object handler, condit; + + handler = Fcar (h); + if (!CONSP (handler)) continue; - tem = Fmemq (Fcar (tem1), conditions); - if (!NILP (tem)) - return tem1; + condit = Fcar (handler); + /* Handle a single condition name in handler HANDLER. */ + if (SYMBOLP (condit)) + { + tem = Fmemq (Fcar (handler), conditions); + if (!NILP (tem)) + return handler; + } + /* Handle a list of condition names in handler HANDLER. */ + else if (CONSP (condit)) + { + while (CONSP (condit)) + { + tem = Fmemq (Fcar (condit), conditions); + if (!NILP (tem)) + return handler; + condit = XCONS (condit)->cdr; + } + } } return Qnil; }