diff options
| author | Richard M. Stallman | 1994-01-11 07:22:11 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-01-11 07:22:11 +0000 |
| commit | 5f96776a9747052106b034045f5632d802ae4e77 (patch) | |
| tree | 5810b272abb916624c4bd10e3d451b3a5b7730ba /src/eval.c | |
| parent | 2abcddce3b79d0efd6e9537e9a2fb420af0ab863 (diff) | |
| download | emacs-5f96776a9747052106b034045f5632d802ae4e77.tar.gz emacs-5f96776a9747052106b034045f5632d802ae4e77.zip | |
(Fcondition_case): Allow a list of condition names in a handler.
(find_handler_clause): Likewise.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 35 |
1 files changed, 27 insertions, 8 deletions
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.") | |||
| 1013 | { | 1013 | { |
| 1014 | Lisp_Object tem; | 1014 | Lisp_Object tem; |
| 1015 | tem = Fcar (val); | 1015 | tem = Fcar (val); |
| 1016 | if ((!NILP (tem)) && | 1016 | if (! (NILP (tem) |
| 1017 | (!CONSP (tem) || (XTYPE (XCONS (tem)->car) != Lisp_Symbol))) | 1017 | || (CONSP (tem) |
| 1018 | && (SYMBOLP (XCONS (tem)->car) | ||
| 1019 | || CONSP (XCONS (tem)->car))))) | ||
| 1018 | error ("Invalid condition handler", tem); | 1020 | error ("Invalid condition handler", tem); |
| 1019 | } | 1021 | } |
| 1020 | 1022 | ||
| @@ -1195,7 +1197,6 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | |||
| 1195 | { | 1197 | { |
| 1196 | register Lisp_Object h; | 1198 | register Lisp_Object h; |
| 1197 | register Lisp_Object tem; | 1199 | register Lisp_Object tem; |
| 1198 | register Lisp_Object tem1; | ||
| 1199 | 1200 | ||
| 1200 | if (EQ (handlers, Qt)) /* t is used by handlers for all conditions, set up by C code. */ | 1201 | if (EQ (handlers, Qt)) /* t is used by handlers for all conditions, set up by C code. */ |
| 1201 | return Qt; | 1202 | return Qt; |
| @@ -1220,12 +1221,30 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | |||
| 1220 | } | 1221 | } |
| 1221 | for (h = handlers; CONSP (h); h = Fcdr (h)) | 1222 | for (h = handlers; CONSP (h); h = Fcdr (h)) |
| 1222 | { | 1223 | { |
| 1223 | tem1 = Fcar (h); | 1224 | Lisp_Object handler, condit; |
| 1224 | if (!CONSP (tem1)) | 1225 | |
| 1226 | handler = Fcar (h); | ||
| 1227 | if (!CONSP (handler)) | ||
| 1225 | continue; | 1228 | continue; |
| 1226 | tem = Fmemq (Fcar (tem1), conditions); | 1229 | condit = Fcar (handler); |
| 1227 | if (!NILP (tem)) | 1230 | /* Handle a single condition name in handler HANDLER. */ |
| 1228 | return tem1; | 1231 | if (SYMBOLP (condit)) |
| 1232 | { | ||
| 1233 | tem = Fmemq (Fcar (handler), conditions); | ||
| 1234 | if (!NILP (tem)) | ||
| 1235 | return handler; | ||
| 1236 | } | ||
| 1237 | /* Handle a list of condition names in handler HANDLER. */ | ||
| 1238 | else if (CONSP (condit)) | ||
| 1239 | { | ||
| 1240 | while (CONSP (condit)) | ||
| 1241 | { | ||
| 1242 | tem = Fmemq (Fcar (condit), conditions); | ||
| 1243 | if (!NILP (tem)) | ||
| 1244 | return handler; | ||
| 1245 | condit = XCONS (condit)->cdr; | ||
| 1246 | } | ||
| 1247 | } | ||
| 1229 | } | 1248 | } |
| 1230 | return Qnil; | 1249 | return Qnil; |
| 1231 | } | 1250 | } |