diff options
| author | Richard M. Stallman | 1997-07-05 19:58:21 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-07-05 19:58:21 +0000 |
| commit | 1ea9dec483263f005dc4c5f8686ba9ed6c2b3ed6 (patch) | |
| tree | c08a9b2ae9f9dfcc323c5a18b9cf463d5c3140c3 /src/eval.c | |
| parent | b1eb5e6abdd53d5739738c52dd079b68a390303d (diff) | |
| download | emacs-1ea9dec483263f005dc4c5f8686ba9ed6c2b3ed6.tar.gz emacs-1ea9dec483263f005dc4c5f8686ba9ed6c2b3ed6.zip | |
(Fsignal, find_handler_clause): If ERROR_SYMBOL
is nil, assume it's in the car of DATA.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/src/eval.c b/src/eval.c index dcbfada26db..e0de0c18636 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -1211,6 +1211,8 @@ See also the function `condition-case'.") | |||
| 1211 | extern int waiting_for_input; | 1211 | extern int waiting_for_input; |
| 1212 | Lisp_Object debugger_value; | 1212 | Lisp_Object debugger_value; |
| 1213 | Lisp_Object string; | 1213 | Lisp_Object string; |
| 1214 | Lisp_Object real_error_symbol; | ||
| 1215 | Lisp_Object combined_data; | ||
| 1214 | 1216 | ||
| 1215 | quit_error_check (); | 1217 | quit_error_check (); |
| 1216 | immediate_quit = 0; | 1218 | immediate_quit = 0; |
| @@ -1221,11 +1223,16 @@ See also the function `condition-case'.") | |||
| 1221 | TOTALLY_UNBLOCK_INPUT; | 1223 | TOTALLY_UNBLOCK_INPUT; |
| 1222 | #endif | 1224 | #endif |
| 1223 | 1225 | ||
| 1226 | if (NILP (error_symbol)) | ||
| 1227 | real_error_symbol = Fcar (data); | ||
| 1228 | else | ||
| 1229 | real_error_symbol = error_symbol; | ||
| 1230 | |||
| 1224 | /* This hook is used by edebug. */ | 1231 | /* This hook is used by edebug. */ |
| 1225 | if (! NILP (Vsignal_hook_function)) | 1232 | if (! NILP (Vsignal_hook_function)) |
| 1226 | call2 (Vsignal_hook_function, error_symbol, data); | 1233 | call2 (Vsignal_hook_function, error_symbol, data); |
| 1227 | 1234 | ||
| 1228 | conditions = Fget (error_symbol, Qerror_conditions); | 1235 | conditions = Fget (real_error_symbol, Qerror_conditions); |
| 1229 | 1236 | ||
| 1230 | for (; handlerlist; handlerlist = handlerlist->next) | 1237 | for (; handlerlist; handlerlist = handlerlist->next) |
| 1231 | { | 1238 | { |
| @@ -1244,7 +1251,7 @@ See also the function `condition-case'.") | |||
| 1244 | { | 1251 | { |
| 1245 | /* We can't return values to code which signaled an error, but we | 1252 | /* We can't return values to code which signaled an error, but we |
| 1246 | can continue code which has signaled a quit. */ | 1253 | can continue code which has signaled a quit. */ |
| 1247 | if (EQ (error_symbol, Qquit)) | 1254 | if (EQ (real_error_symbol, Qquit)) |
| 1248 | return Qnil; | 1255 | return Qnil; |
| 1249 | else | 1256 | else |
| 1250 | error ("Cannot return from the debugger in an error"); | 1257 | error ("Cannot return from the debugger in an error"); |
| @@ -1257,8 +1264,9 @@ See also the function `condition-case'.") | |||
| 1257 | struct handler *h = handlerlist; | 1264 | struct handler *h = handlerlist; |
| 1258 | 1265 | ||
| 1259 | handlerlist = allhandlers; | 1266 | handlerlist = allhandlers; |
| 1260 | if (EQ (data, memory_signal_data)) | 1267 | |
| 1261 | unwind_data = memory_signal_data; | 1268 | if (NILP (error_symbol)) |
| 1269 | unwind_data = data; | ||
| 1262 | else | 1270 | else |
| 1263 | unwind_data = Fcons (error_symbol, data); | 1271 | unwind_data = Fcons (error_symbol, data); |
| 1264 | h->chosen_clause = clause; | 1272 | h->chosen_clause = clause; |
| @@ -1273,7 +1281,7 @@ See also the function `condition-case'.") | |||
| 1273 | if (catchlist != 0) | 1281 | if (catchlist != 0) |
| 1274 | Fthrow (Qtop_level, Qt); | 1282 | Fthrow (Qtop_level, Qt); |
| 1275 | 1283 | ||
| 1276 | if (! EQ (data, memory_signal_data)) | 1284 | if (! NILP (error_symbol)) |
| 1277 | data = Fcons (error_symbol, data); | 1285 | data = Fcons (error_symbol, data); |
| 1278 | 1286 | ||
| 1279 | string = Ferror_message_string (data); | 1287 | string = Ferror_message_string (data); |
| @@ -1344,6 +1352,10 @@ skip_debugger (conditions, data) | |||
| 1344 | } | 1352 | } |
| 1345 | 1353 | ||
| 1346 | /* Value of Qlambda means we have called debugger and user has continued. | 1354 | /* Value of Qlambda means we have called debugger and user has continued. |
| 1355 | There are two ways to pass SIG and DATA: | ||
| 1356 | - SIG is the error symbol, and DATA is the rest of the data. | ||
| 1357 | = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). | ||
| 1358 | |||
| 1347 | Store value returned from debugger into *DEBUGGER_VALUE_PTR. */ | 1359 | Store value returned from debugger into *DEBUGGER_VALUE_PTR. */ |
| 1348 | 1360 | ||
| 1349 | static Lisp_Object | 1361 | static Lisp_Object |
| @@ -1364,20 +1376,31 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | |||
| 1364 | { | 1376 | { |
| 1365 | int count = specpdl_ptr - specpdl; | 1377 | int count = specpdl_ptr - specpdl; |
| 1366 | int debugger_called = 0; | 1378 | int debugger_called = 0; |
| 1379 | Lisp_Object sig_symbol, combined_data; | ||
| 1380 | |||
| 1381 | if (NILP (sig)) | ||
| 1382 | { | ||
| 1383 | combined_data = data; | ||
| 1384 | sig_symbol = Fcar (data); | ||
| 1385 | } | ||
| 1386 | else | ||
| 1387 | { | ||
| 1388 | combined_data = Fcons (sig, data); | ||
| 1389 | sig_symbol = sig; | ||
| 1390 | } | ||
| 1367 | 1391 | ||
| 1368 | if (wants_debugger (Vstack_trace_on_error, conditions)) | 1392 | if (wants_debugger (Vstack_trace_on_error, conditions)) |
| 1369 | internal_with_output_to_temp_buffer ("*Backtrace*", Fbacktrace, Qnil); | 1393 | internal_with_output_to_temp_buffer ("*Backtrace*", Fbacktrace, Qnil); |
| 1370 | if ((EQ (sig, Qquit) | 1394 | if ((EQ (sig_symbol, Qquit) |
| 1371 | ? debug_on_quit | 1395 | ? debug_on_quit |
| 1372 | : wants_debugger (Vdebug_on_error, conditions)) | 1396 | : wants_debugger (Vdebug_on_error, conditions)) |
| 1373 | && ! skip_debugger (conditions, Fcons (sig, data)) | 1397 | && ! skip_debugger (conditions, combined_data) |
| 1374 | && when_entered_debugger < num_nonmacro_input_events) | 1398 | && when_entered_debugger < num_nonmacro_input_events) |
| 1375 | { | 1399 | { |
| 1376 | specbind (Qdebug_on_error, Qnil); | 1400 | specbind (Qdebug_on_error, Qnil); |
| 1377 | *debugger_value_ptr | 1401 | *debugger_value_ptr |
| 1378 | = call_debugger (Fcons (Qerror, | 1402 | = call_debugger (Fcons (Qerror, |
| 1379 | Fcons (Fcons (sig, data), | 1403 | Fcons (combined_data, Qnil))); |
| 1380 | Qnil))); | ||
| 1381 | debugger_called = 1; | 1404 | debugger_called = 1; |
| 1382 | } | 1405 | } |
| 1383 | /* If there is no handler, return saying whether we ran the debugger. */ | 1406 | /* If there is no handler, return saying whether we ran the debugger. */ |