🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99098

init file debugging

#99098
From: LUSYSNZ
Date: Fri, 26 Oct 1990 21:37
83 lines
3230 bytes
Relay-Version: VMS News - V5.9C 19/12/89 VAX/VMS V5.3; site vax1.cc.lehigh.edu
Path: vax1.cc.lehigh.edu!vax1.cc.lehigh.edu!netnews.upenn.edu!rutgers!tut.cis.ohio-state.edu!VERITY.COM!dca
Newsgroups: gnu.emacs.bug
Subject: init file debugging
Message-ID: <9010171806.AA13437@verity.com>
From: dca@VERITY.COM (David Anderson)
Date: 17 Oct 90 18:06:39 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Approved: bug-gnu-emacs@prep.ai.mit.edu
Lines: 70

I've found these changes useful in tracking down bugs in init files, where
the normal debugging stuff doesn't work too well.  The changes are to
18.55.  There's probably a better way to do this, but I haven't found
it, although its packaging could be improved.

I lost the original version, so here's the changed line:
In startup.el:command-line, verbosify the initial error message.
Often this is enough to find the problem.

(condition-case error
    ...
      (error (message "Error in init file: %s" error)))


In eval.c, include support for backtracing and entering a debugger
from init files.

 119a120,124
 > /* signal-internal debugger support, so you can find the bug without
 >  unwinding the stack. */
 >
 > Lisp_Object Vsignal_error_handler;
 >
 1019a1025
 >   static int in_signal_error_handler = 0;
 1024a1031
 >   Lisp_Object args[3];
 1030a1038,1047
 >   if (! EQ (XSYMBOL (Vsignal_error_handler)->value, Qnil) &&
 >       ! in_signal_error_handler){
 >     in_signal_error_handler = 1;
 >     args[0] = Vsignal_error_handler;
 >     args[1] = sig;
 >     args[2] = data;
 >     Fapply (3, args);
 >     in_signal_error_handler = 0;
 >   }
 >
 2100a2118,2123
 >
 >   DEFVAR_LISP ("signal-error-handler", &Vsignal_error_handler,
 >     "Function to call from within signal under any circumstances.\n\
 > This allows the full environment of the error to be used for\n\
 > debugging.  Args SIGNAL and DATA are values passed to signal or error.");
 >   Vsignal_error_handler = Qnil;

And then in your init file, near the top, turn it on

 >(defun startup-backtrace (error data)
 >  (with-output-to-temp-buffer "*Backtrace*"
 >    (progn
 >      (princ error)
 >      (princ " ")
 >      (princ data)
 >      (princ "\n")
 >      (backtrace))))
 >(defun startup-debug (error data)
 >  (backtrace-debug 0 t))
 >
 >(setq signal-error-handler 'startup-backtrace)
or...
 >(setq signal-error-handler 'startup-debug)

and off at the end

 >(setq signal-error-handler nil)

					enjoy,
						dca
"p
Technical Details
Message-ID: <138E4D09E1FF800042@VAX1.CC.LEHIGH.EDU>
Path: arc1-ca.pugleaf.net!gmdzi!unido!isaak!escher!nadia!smurf!ira.uka.de!sol.ctr.columbia.edu!cica!tut.cis.ohio-state.edu!VAX1.CC.LEHIGH.EDU!LUSYSNZ

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,2174a03bbb497c35,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-10-26 14:37:00 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!isaak!escher!nadia!smurf!ira.uka.de!sol.ctr.columbia.edu!cica!tut.cis.ohio-state.edu!VAX1.CC.LEHIGH.EDU!LUSYSNZ
From: LUSYSNZ@VAX1.CC.LEHIGH.EDU
Newsgroups: gnu.emacs.bug
Subject: init file debugging
Message-ID: <138E4D09E1FF800042@VAX1.CC.LEHIGH.EDU>
Date: 26 Oct 90 21:37:00 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: Gnus Not Usenet
Lines: 83
Approved: bug-gnu-emacs@prep.ai.mit.edu
Posted: Fri Oct 26 22:37:00 1990