🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #2173

Re: debugging .emacs

#2173
From: Richard Levitte
Date: Sat, 23 Jan 1993 16:45
53 lines
2538 bytes
>>>>> On 22 Jan 1993 19:16:29 GMT, nickel@cs.tu-berlin.de (Juergen Nickelsen) said:

JN> Unfortunately debugging .emacs is not very intuitive. Here is what I
JN> do: 

JN> The code in my .emacs is embedded in a let contruct which sets
JN> debug-on-error to t:

JN>   (let ((debug-on-error t))

JN>     ;; startup code

JN>     )

JN> This way Emacs doesn't behave different on error in the .emacs when
JN> starting up (i.e. only the non-descriptive message "Error in init
JN> file" appears), but I can start Emacs with the -q switch ("Do not load
JN> your Emacs init file `~/.emacs'"), then do a (load-file ".emacs").

It is possible to make that error message a little more descriptive
with the following patch on startup.el:

*** ed:[orig.lisp]startup.el
--- ed:[new.lisp]startup.el
**************
*** 124,130
  			 ;; Don't you dare turn this off for anyone
  			 ;; except yourself.
  			 (load "default" t t)))))
!       (error (message "Error in init file")))
      (if (get-buffer "*scratch*")
  	(save-excursion
  	  (set-buffer "*scratch*")
--- 124,130 -----
  			 ;; Don't you dare turn this off for anyone
  			 ;; except yourself.
  			 (load "default" t t)))))
!       (error (message (format "Error in init file: %s" error))))
      (if (get-buffer "*scratch*")
  	(save-excursion
  	  (set-buffer "*scratch*")


The message can be a little cryptic, but it helps to get the message:
"Error in init file: (void-variable foo)"

--
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
! Richard Levitte, VMS GNU Emacs hacker   ! tel: int+46-8-18 30 99            !
! Sulv"agen 57, II                        ! fax: none for the moment          !
! S-126 40 H"agersten                     ! Internet: levitte@e.kth.se        !
! SWEDEN                                  !                                   !
!-----------------------------------------------------------------------------!
Technical Details
Message-ID: <LEVITTE.93Jan23174528@elin.e.kth.se>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!kth.se!news.kth.se!LEVITTE
References: <PSHANNON.93Jan20220406@iapetus.cv.nrao.edu> <NICKEL.93Jan22201627@tempest.cs.tu-berlin.de>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.help
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!kth.se!news.kth.se!LEVITTE
From: LEVITTE@e.kth.se (Richard Levitte)
Subject: Re: debugging .emacs
In-Reply-To: nickel@cs.tu-berlin.de's message of 22 Jan 1993 19:16:29 GMT
Message-ID: <LEVITTE.93Jan23174528@elin.e.kth.se>
Sender: usenet@kth.se (Usenet)
Nntp-Posting-Host: elin.e.kth.se
Organization: Department of TeleTransmission Theory
References: <PSHANNON.93Jan20220406@iapetus.cv.nrao.edu>
 <NICKEL.93Jan22201627@tempest.cs.tu-berlin.de>
Date: Sat, 23 Jan 1993 16:45:28 GMT
Lines: 53