diff options
| author | Karl Heuer | 1995-12-21 17:00:18 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-12-21 17:00:18 +0000 |
| commit | fc950e091092de48ee482b3974db8f68a9d49143 (patch) | |
| tree | 6b34da8126267acff7011328a746b014044cedb6 /src/eval.c | |
| parent | 260e2e2a337a5f91ac889359992a1ab95dde8b78 (diff) | |
| download | emacs-fc950e091092de48ee482b3974db8f68a9d49143.tar.gz emacs-fc950e091092de48ee482b3974db8f68a9d49143.zip | |
(skip_debugger): New function.
(find_handler_clause): Call skip_debugger.
(Vdebug_ignored_errors): New variable.
(syms_of_eval): Set up Lisp variable.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 61 |
1 files changed, 57 insertions, 4 deletions
diff --git a/src/eval.c b/src/eval.c index 91a98d6206d..cb107191244 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -127,6 +127,10 @@ Lisp_Object Vstack_trace_on_error; | |||
| 127 | if an error is handled by the command loop's error handler. */ | 127 | if an error is handled by the command loop's error handler. */ |
| 128 | Lisp_Object Vdebug_on_error; | 128 | Lisp_Object Vdebug_on_error; |
| 129 | 129 | ||
| 130 | /* List of conditions and regexps specifying error messages which | ||
| 131 | do not enter the debugger even if Vdebug_on_errors says they should. */ | ||
| 132 | Lisp_Object Vdebug_ignored_errors; | ||
| 133 | |||
| 130 | /* Nonzero means enter debugger if a quit signal | 134 | /* Nonzero means enter debugger if a quit signal |
| 131 | is handled by the command loop's error handler. */ | 135 | is handled by the command loop's error handler. */ |
| 132 | int debug_on_quit; | 136 | int debug_on_quit; |
| @@ -1259,6 +1263,45 @@ wants_debugger (list, conditions) | |||
| 1259 | return 0; | 1263 | return 0; |
| 1260 | } | 1264 | } |
| 1261 | 1265 | ||
| 1266 | /* Return 1 if an error with condition-symbols CONDITIONS, | ||
| 1267 | and described by SIGNAL-DATA, should skip the debugger | ||
| 1268 | according to debugger-ignore-errors. */ | ||
| 1269 | |||
| 1270 | static int | ||
| 1271 | skip_debugger (conditions, data) | ||
| 1272 | Lisp_Object conditions, data; | ||
| 1273 | { | ||
| 1274 | Lisp_Object tail; | ||
| 1275 | int first_string = 1; | ||
| 1276 | Lisp_Object error_message; | ||
| 1277 | |||
| 1278 | for (tail = Vdebug_ignored_errors; CONSP (tail); | ||
| 1279 | tail = XCONS (tail)->cdr) | ||
| 1280 | { | ||
| 1281 | if (STRINGP (XCONS (tail)->car)) | ||
| 1282 | { | ||
| 1283 | if (first_string) | ||
| 1284 | { | ||
| 1285 | error_message = Ferror_message_string (data); | ||
| 1286 | first_string = 0; | ||
| 1287 | } | ||
| 1288 | if (fast_string_match (XCONS (tail)->car, error_message) >= 0) | ||
| 1289 | return 1; | ||
| 1290 | } | ||
| 1291 | else | ||
| 1292 | { | ||
| 1293 | Lisp_Object contail; | ||
| 1294 | |||
| 1295 | for (contail = conditions; CONSP (contail); | ||
| 1296 | contail = XCONS (contail)->cdr) | ||
| 1297 | if (EQ (XCONS (tail)->car, XCONS (contail)->car)) | ||
| 1298 | return 1; | ||
| 1299 | } | ||
| 1300 | } | ||
| 1301 | |||
| 1302 | return 0; | ||
| 1303 | } | ||
| 1304 | |||
| 1262 | /* Value of Qlambda means we have called debugger and user has continued. | 1305 | /* Value of Qlambda means we have called debugger and user has continued. |
| 1263 | Store value returned from debugger into *DEBUGGER_VALUE_PTR. */ | 1306 | Store value returned from debugger into *DEBUGGER_VALUE_PTR. */ |
| 1264 | 1307 | ||
| @@ -1279,14 +1322,15 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | |||
| 1279 | if ((EQ (sig, Qquit) | 1322 | if ((EQ (sig, Qquit) |
| 1280 | ? debug_on_quit | 1323 | ? debug_on_quit |
| 1281 | : wants_debugger (Vdebug_on_error, conditions)) | 1324 | : wants_debugger (Vdebug_on_error, conditions)) |
| 1325 | && ! skip_debugger (conditions, Fcons (sig, data)) | ||
| 1282 | && when_entered_debugger < num_nonmacro_input_chars) | 1326 | && when_entered_debugger < num_nonmacro_input_chars) |
| 1283 | { | 1327 | { |
| 1284 | int count = specpdl_ptr - specpdl; | 1328 | int count = specpdl_ptr - specpdl; |
| 1285 | specbind (Qdebug_on_error, Qnil); | 1329 | specbind (Qdebug_on_error, Qnil); |
| 1286 | *debugger_value_ptr = | 1330 | *debugger_value_ptr |
| 1287 | call_debugger (Fcons (Qerror, | 1331 | = call_debugger (Fcons (Qerror, |
| 1288 | Fcons (Fcons (sig, data), | 1332 | Fcons (Fcons (sig, data), |
| 1289 | Qnil))); | 1333 | Qnil))); |
| 1290 | return unbind_to (count, Qlambda); | 1334 | return unbind_to (count, Qlambda); |
| 1291 | } | 1335 | } |
| 1292 | return Qt; | 1336 | return Qt; |
| @@ -2821,6 +2865,15 @@ if one of its condition symbols appears in the list.\n\ | |||
| 2821 | See also variable `debug-on-quit'."); | 2865 | See also variable `debug-on-quit'."); |
| 2822 | Vdebug_on_error = Qnil; | 2866 | Vdebug_on_error = Qnil; |
| 2823 | 2867 | ||
| 2868 | DEFVAR_LISP ("debug-ignored-errors", &Vdebug_ignored_errors, | ||
| 2869 | "*List of errors for which the debugger should not be called.\n\ | ||
| 2870 | Each element may be a condition-name or a regexp that matches error messages.\n\ | ||
| 2871 | If any element applies to a given error, that error skips the debugger\n\ | ||
| 2872 | and just returns to top level.\n\ | ||
| 2873 | This overrides the variable `debug-on-error'.\n\ | ||
| 2874 | It does not apply to errors handled by `condition-case'."); | ||
| 2875 | Vdebug_ignored_errors = Qnil; | ||
| 2876 | |||
| 2824 | DEFVAR_BOOL ("debug-on-quit", &debug_on_quit, | 2877 | DEFVAR_BOOL ("debug-on-quit", &debug_on_quit, |
| 2825 | "*Non-nil means enter debugger if quit is signaled (C-g, for example).\n\ | 2878 | "*Non-nil means enter debugger if quit is signaled (C-g, for example).\n\ |
| 2826 | Does not apply if quit is handled by a `condition-case'."); | 2879 | Does not apply if quit is handled by a `condition-case'."); |