debugging errors in emacs (.emacs)

So recently i wanted to try to add on other popular emacs packages such as elscreen and Do Re Mi (doremi). However, I couldn’t configure them to work as i got some errors after adding stuff to my .emacs. I posted comments on people’s blogs and emailed them to try to figure this out.

Finally, I contacted Drew Adams, the author of Doremi and many other popular emacs packages (search in my vinhdizzo email for his email address). He was willing to help me. The following was his email, which showed me how to debug in emacs very efficiently. If i added new stuff in emacs and i get errors, do:

  1. start emacs without all the baggage, ie, emacs -Q
  2. try executing those new emacs code, either by M-x, or by highlighting them and doing M-x eval-region.
  3. if there is a bug, then i should still get an error still here.

otherwise, the error must be some kind of conflicts. try moving this up my .emacs somewhere (this work for both of those packages i mentioned before).

2nd tip i got from drew adams is to do binary search when i don’t know where the error came from in my .emacs. his email sums it up: “”” OK. So the first lesson learned is to test without all of the extra baggage in your .emacs.

Here’s the second lesson: ;-)

To find what is causing the problem in your .emacs, use a binary search: Comment out half of the file and see whether the problem is there. Then comment out half of the problem half, then half of that problem quarter, then… Binary search is very quick – in very little time you’ll know what’s causing the problem.

You probably already knew that, but it’s always worth repeating, just in case.

Good luck. Let me know if the problem comes from one of my libraries.

Regards,

Drew “””

Man i love the open source community!

About Vinh Nguyen

Statistician

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>