emacs_legendaryI love Emacs. I use it every day for programming, writing, schoolwork, web stuff, email, news, listening to music, whatever. Sometimes I have to use different Emacs on remote machines and I have to revert to the default setup (tramp mitigates this somewhat). This means that I have to go back to that horrible (or wonderful I guess) day that I started Emacs for the first time and struggled like a bitch just to navigate the info page.

In order to avoid that, I often place a stripped down copy of my .emacs on each machine so that the bare minimum of my customizations are available (I actually used to carry around a basic .emacs on a USB stick). But when you do this, you sometimes end up with a .emacs that won’t load correctly because things are in the wrong location or not present on the current machine.

So, I was doing this the other day and I learned a command that I should have known since the beginning but it was one that I seemed to have missed. “M-x toggle-debug-on-error“! Basically drops you into the elisp debugger whenever something is fubar, giving you a complete stack trace of the error. Perfect.

There are other ways to set debug flags directly in the .emacs file itself like adding:

(setq debug-on-error t)

Or you can start Emacs with the --debug-init flag (this one I already knew)

Now, it only takes me a few minutes to figure out the exact source of the trouble. Doh!