changeset 30073:ed8f34a43649

(Vsignaling_function): New variable. (Fsignal): Compute it. (syms_of_eval): Staticpro it.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 05 Jul 2000 17:24:19 +0000
parents da80009c3957
children e06697d4135f
files src/eval.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c	Wed Jul 05 17:23:15 2000 +0000
+++ b/src/eval.c	Wed Jul 05 17:24:19 2000 +0000
@@ -163,6 +163,11 @@
 
 Lisp_Object Vdebugger;
 
+/* The function from which the last `signal' was called.  Set in
+   Fsignal.  */
+
+Lisp_Object Vsignaling_function;
+
 void specbind (), record_unwind_protect ();
 
 Lisp_Object run_hook_with_args ();
@@ -1274,6 +1279,7 @@
   Lisp_Object string;
   Lisp_Object real_error_symbol;
   extern int display_busy_cursor_p;
+  struct backtrace *bp;
 
   immediate_quit = 0;
   if (gc_in_progress || waiting_for_input)
@@ -1297,6 +1303,14 @@
 
   conditions = Fget (real_error_symbol, Qerror_conditions);
 
+  /* Remember from where signal was called.  Skip over the frame for
+     `signal' itself.  If a frame for `error' follows, skip that,
+     too.  */
+  bp = backtrace_list->next;
+  if (bp && bp->function && EQ (*bp->function, Qerror))
+    bp = bp->next;
+  Vsignaling_function = bp && bp->function ? *bp->function : Qnil;
+
   for (; handlerlist; handlerlist = handlerlist->next)
     {
       register Lisp_Object clause;
@@ -3066,6 +3080,7 @@
       return Fcons (Qt, Fcons (*backlist->function, tem));
     }
 }
+
 
 void
 syms_of_eval ()
@@ -3197,6 +3212,8 @@
 
   staticpro (&Vautoload_queue);
   Vautoload_queue = Qnil;
+  staticpro (&Vsignaling_function);
+  Vsignaling_function = Qnil;
 
   defsubr (&Sor);
   defsubr (&Sand);