Guangwang Huang, over at whatacold’s space, has a useful post on debugging Emacs. It’s aimed at beginners but will be useful for more experienced Emacsers too. The basic idea is what you should do when you start Emacs and get an error. This most often happens after you upgrade a package and can be hard to deal with.
The first thing to do, of course, is to start a clean invocation of Emacs. The easy way to do that is with emacs -Q
. That gives you a “clean” copy of Emacs without any of your configuration or packages. Of course, the problem probably lies in a package so you want a clean Emacs but with that suspect package loaded too. The first step is to determine the offending package. Starting Emacs with emacs --debug-init
will help you find the proper package and then you need to start a clean Emacs with just that package loaded. Huang shows how to do that. At this point you can start drilling down to find the actual problem.
The main way to do that is to tell Emacs to drop you into the debugger and give you a backtrace when an error occurs. There are several events you can use to trigger this including, even, the output of a message that matches a regular expression. Take a look at Huang’s post for the details.
There’s nothing particularly advanced about Huang’s post but it provides just the information you need to solve many of the problems you encounter with Emacs. It’s reasonably short so there’s no reason you shouldn’t a couple of minutes reading it.