Subject: Re: bug#4228: 23.1; --script and stack-trace-on-error

From: Tom Tromey <[email-masked]>
Date: Fri, 18 Sep 2009 19:57:44 -0600

Dan> [No idea why stack-trace-on-error does not work]

I looked at this a little bit.

eval.c:find_handler_clause prints to a buffer named *Backtrace*.  So,
I'm guessing that the stack trace is created -- just not visible.

The appended patch works for me.

Tom

2009-09-19  Tom Tromey  <[email-masked]>

	* eval.c (find_handler_clause): Respect 'noninteractive'.

diff --git a/src/eval.c b/src/eval.c
index 8299474..44f8ec7 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1922,14 +1922,19 @@ find_handler_clause (handlers, conditions, sig, data)
 	{
 	  max_lisp_eval_depth += 15;
 	  max_specpdl_size++;
+	  if (noninteractive)
+	    Fbacktrace ();
+	  else
+	    {
 #ifdef PROTOTYPES
-	  internal_with_output_to_temp_buffer ("*Backtrace*",
-					       (Lisp_Object (*) (Lisp_Object)) Fbacktrace,
-					       Qnil);
+	      internal_with_output_to_temp_buffer ("*Backtrace*",
+						   (Lisp_Object (*) (Lisp_Object)) Fbacktrace,
+						   Qnil);
 #else
-	  internal_with_output_to_temp_buffer ("*Backtrace*",
-					       Fbacktrace, Qnil);
+	      internal_with_output_to_temp_buffer ("*Backtrace*",
+						   Fbacktrace, Qnil);
 #endif
+	    }
 	  max_specpdl_size--;
 	  max_lisp_eval_depth -= 15;
 	}