# HG changeset patch # User Karl Heuer # Date 819565218 0 # Node ID 353d32d374db0dbab8f11cb97e75b7d51cfa5450 # Parent 862fff66044634f3a33bac0d1a3c21015dcb764b (skip_debugger): New function. (find_handler_clause): Call skip_debugger. (Vdebug_ignored_errors): New variable. (syms_of_eval): Set up Lisp variable. diff -r 862fff660446 -r 353d32d374db src/eval.c --- a/src/eval.c Thu Dec 21 16:58:55 1995 +0000 +++ b/src/eval.c Thu Dec 21 17:00:18 1995 +0000 @@ -127,6 +127,10 @@ if an error is handled by the command loop's error handler. */ Lisp_Object Vdebug_on_error; +/* List of conditions and regexps specifying error messages which + do not enter the debugger even if Vdebug_on_errors says they should. */ +Lisp_Object Vdebug_ignored_errors; + /* Nonzero means enter debugger if a quit signal is handled by the command loop's error handler. */ int debug_on_quit; @@ -1259,6 +1263,45 @@ return 0; } +/* Return 1 if an error with condition-symbols CONDITIONS, + and described by SIGNAL-DATA, should skip the debugger + according to debugger-ignore-errors. */ + +static int +skip_debugger (conditions, data) + Lisp_Object conditions, data; +{ + Lisp_Object tail; + int first_string = 1; + Lisp_Object error_message; + + for (tail = Vdebug_ignored_errors; CONSP (tail); + tail = XCONS (tail)->cdr) + { + if (STRINGP (XCONS (tail)->car)) + { + if (first_string) + { + error_message = Ferror_message_string (data); + first_string = 0; + } + if (fast_string_match (XCONS (tail)->car, error_message) >= 0) + return 1; + } + else + { + Lisp_Object contail; + + for (contail = conditions; CONSP (contail); + contail = XCONS (contail)->cdr) + if (EQ (XCONS (tail)->car, XCONS (contail)->car)) + return 1; + } + } + + return 0; +} + /* Value of Qlambda means we have called debugger and user has continued. Store value returned from debugger into *DEBUGGER_VALUE_PTR. */ @@ -1279,14 +1322,15 @@ if ((EQ (sig, Qquit) ? debug_on_quit : wants_debugger (Vdebug_on_error, conditions)) + && ! skip_debugger (conditions, Fcons (sig, data)) && when_entered_debugger < num_nonmacro_input_chars) { int count = specpdl_ptr - specpdl; specbind (Qdebug_on_error, Qnil); - *debugger_value_ptr = - call_debugger (Fcons (Qerror, - Fcons (Fcons (sig, data), - Qnil))); + *debugger_value_ptr + = call_debugger (Fcons (Qerror, + Fcons (Fcons (sig, data), + Qnil))); return unbind_to (count, Qlambda); } return Qt; @@ -2821,6 +2865,15 @@ See also variable `debug-on-quit'."); Vdebug_on_error = Qnil; + DEFVAR_LISP ("debug-ignored-errors", &Vdebug_ignored_errors, + "*List of errors for which the debugger should not be called.\n\ +Each element may be a condition-name or a regexp that matches error messages.\n\ +If any element applies to a given error, that error skips the debugger\n\ +and just returns to top level.\n\ +This overrides the variable `debug-on-error'.\n\ +It does not apply to errors handled by `condition-case'."); + Vdebug_ignored_errors = Qnil; + DEFVAR_BOOL ("debug-on-quit", &debug_on_quit, "*Non-nil means enter debugger if quit is signaled (C-g, for example).\n\ Does not apply if quit is handled by a `condition-case'.");