From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: Help Date: Mon, 11 Jan 2010 09:36:11 +1100 Organization: Rapt Technologies Message-ID: <87k4vpoaec.fsf@lion.rapttech.com.au> References: <87d41i2sg7.fsf@Traian.DecebalComp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1263163255 20548 80.91.229.12 (10 Jan 2010 22:40:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Jan 2010 22:40:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 10 23:40:48 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NU6Sl-0005me-J2 for geh-help-gnu-emacs@m.gmane.org; Sun, 10 Jan 2010 23:40:47 +0100 Original-Received: from localhost ([127.0.0.1]:44519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NU6Sm-0004Ok-7v for geh-help-gnu-emacs@m.gmane.org; Sun, 10 Jan 2010 17:40:48 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.kjsl.com!news.alt.net!news.astraweb.com!border1.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) Cancel-Lock: sha1:9PwK7+gkmGHrTdzYqNzsMZHOhW4= Original-Lines: 67 Original-NNTP-Posting-Host: b0964778.news.astraweb.com Original-X-Trace: DXC=Db_TVDCd:k35WGRN4JSiW2L?0kYOcDh@:h5C[T]=8Rh6BZ4hSa9_FE=[XK99=b\o12b[Z7EcH=VN0 Original-Xref: news.stanford.edu gnu.emacs.help:176091 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:71162 Archived-At: Cecil Westerhof writes: > "Rhey, David" writes: > >> There is a list of things that comes before this error, and a small suggestion >> to run ??debug-init? after it. I?ve been working on this off and on for awhile >> now, but haven?t made any breakthroughs. Any help or insight would be most >> appreciated. > > What I always find useful when debugging -and that is what you need to > do- is commenting things out. > I just would comment almost everything out and then start Emacs. If it > goes alright, there is no problem with that. Then uncomment something, > etc. When you know which code gives the problem, it is easier to solve. > And if you can not solve it, you can 'exactly' tell what the problem is > and it is easier for the people here to solve it. When you have an error in a .emacs file, especially if its a very large one, I find the following useful. 1. Run with --debug-init. This will provide a backtrace which is often enough to find the offending line. 2. If that doesn't help, a 'binary search' approach is often helpful. Rather than commenting out all the lines, put a couple of message lines in. Start with a line at around half way in the file i.e. (Message "Got to checkpoint 1") The error will either be in the first half or the second half. So, next time you start emacs, check the messages buffer. If your message is in there, you know your error is in the second half of the file, otherwise, its in the first half. Once you have narrowed it down to which half, put another message halfway in that half i.e. (message "Got to checkpoint 2) Keep repeating the process until you narrow down to the command with the error. Another thing I do to make management of my .emacs easier is that I break of related functionality into its own file. I put all these files into a directory and add that directory to the emacs load-path. Each file ends with a 'provides' line. I then just have 'require' lines in my .emacs. For example, I have all my org mode stuff in a file called tx-org.el. The last line of that file is (provide 'tx-org) In my .emacs I have a couple of lines at the top which set my private elisp directories and then I have something like (require 'tx-org) I find this helps prevent my .emacs from becoming to large and clutterd and I can add/remove related config settings just by commenting/uncommenting one line in my .emacs. Another nice side effect is that when I do have an error and I run debug-init, it usually clearly indicates which of my config files the error is in, making it quick to track down. Tim -- tcross (at) rapttech dot com dot au