changeset 18636:b3f3cd32fa70

(Fsignal, find_handler_clause): If ERROR_SYMBOL is nil, assume it's in the car of DATA.
author Richard M. Stallman <rms@gnu.org>
date Sat, 05 Jul 1997 19:58:21 +0000
parents d55ebf568fe7
children 62cf644c438b
files src/eval.c
diffstat 1 files changed, 32 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c	Sat Jul 05 19:28:02 1997 +0000
+++ b/src/eval.c	Sat Jul 05 19:58:21 1997 +0000
@@ -1211,6 +1211,8 @@
   extern int waiting_for_input;
   Lisp_Object debugger_value;
   Lisp_Object string;
+  Lisp_Object real_error_symbol;
+  Lisp_Object combined_data;
 
   quit_error_check ();
   immediate_quit = 0;
@@ -1221,11 +1223,16 @@
   TOTALLY_UNBLOCK_INPUT;
 #endif
 
+  if (NILP (error_symbol))
+    real_error_symbol = Fcar (data);
+  else
+    real_error_symbol = error_symbol;
+
   /* This hook is used by edebug.  */
   if (! NILP (Vsignal_hook_function))
     call2 (Vsignal_hook_function, error_symbol, data);
 
-  conditions = Fget (error_symbol, Qerror_conditions);
+  conditions = Fget (real_error_symbol, Qerror_conditions);
 
   for (; handlerlist; handlerlist = handlerlist->next)
     {
@@ -1244,7 +1251,7 @@
 	{
 	  /* We can't return values to code which signaled an error, but we
 	     can continue code which has signaled a quit.  */
-	  if (EQ (error_symbol, Qquit))
+	  if (EQ (real_error_symbol, Qquit))
 	    return Qnil;
 	  else
 	    error ("Cannot return from the debugger in an error");
@@ -1257,8 +1264,9 @@
 	  struct handler *h = handlerlist;
 
 	  handlerlist = allhandlers;
-	  if (EQ (data, memory_signal_data))
-	    unwind_data = memory_signal_data;
+
+	  if (NILP (error_symbol))
+	    unwind_data = data;
 	  else
 	    unwind_data = Fcons (error_symbol, data);
 	  h->chosen_clause = clause;
@@ -1273,7 +1281,7 @@
   if (catchlist != 0)
     Fthrow (Qtop_level, Qt);
 
-  if (! EQ (data, memory_signal_data))
+  if (! NILP (error_symbol))
     data = Fcons (error_symbol, data);
 
   string = Ferror_message_string (data);
@@ -1344,6 +1352,10 @@
 }
 
 /* Value of Qlambda means we have called debugger and user has continued.
+   There are two ways to pass SIG and DATA:
+    - SIG is the error symbol, and DATA is the rest of the data.
+    = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA).
+
    Store value returned from debugger into *DEBUGGER_VALUE_PTR.  */
 
 static Lisp_Object
@@ -1364,20 +1376,31 @@
     {
       int count = specpdl_ptr - specpdl;
       int debugger_called = 0;
+      Lisp_Object sig_symbol, combined_data;
+
+      if (NILP (sig))
+	{
+	  combined_data = data;
+	  sig_symbol = Fcar (data);
+	}
+      else
+	{
+	  combined_data = Fcons (sig, data);
+	  sig_symbol = sig;
+	}
 
       if (wants_debugger (Vstack_trace_on_error, conditions))
 	internal_with_output_to_temp_buffer ("*Backtrace*", Fbacktrace, Qnil);
-      if ((EQ (sig, Qquit)
+      if ((EQ (sig_symbol, Qquit)
 	   ? debug_on_quit
 	   : wants_debugger (Vdebug_on_error, conditions))
-	  && ! skip_debugger (conditions, Fcons (sig, data))
+	  && ! skip_debugger (conditions, combined_data)
 	  && when_entered_debugger < num_nonmacro_input_events)
 	{
 	  specbind (Qdebug_on_error, Qnil);
 	  *debugger_value_ptr
 	    = call_debugger (Fcons (Qerror,
-				    Fcons (Fcons (sig, data),
-					   Qnil)));
+				    Fcons (combined_data, Qnil)));
 	  debugger_called = 1;
 	}
       /* If there is no handler, return saying whether we ran the debugger.  */