# HG changeset patch # User Oleksandr Gavenko # Date 1232377009 -7200 # Node ID e35491992b6202b47ba5cb48731fb22d318f51d6 # Parent a0c29be69a91ff2a17fa4dc70d0209e8f41d8c94 up diff -r a0c29be69a91 -r e35491992b62 emacs.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emacs.rst Mon Jan 19 16:56:49 2009 +0200 @@ -0,0 +1,26 @@ +-*- mode: outline -*- + +* How debug? + +When your InitFile has a bug, or when you load external files that cause +errors, the bug is often hard to find, because the Emacs Lisp reader does not +know about line numbers and files – it just knows an error happened, and +that’s it. + +You have several options: + + * Binary Search – select half of the file in a region, and M-x eval-region. + Depending on whether that causes the error or not, split this half or the + other half again, and repeat. + + * Simplified Binary Search – add (error “No error until here”) in the + middle of your file. If you get the error “No error until here” when + reloading the file, move the expression towards the back of the file, + otherwise towards the front of the file. + + * Use a keyboard macro that moves forward one expression (sexp) and + evaluates it. + + * Try the CommandLine? switch --debug-init. + + * Shouldn’t (setq debug-on-error t) help?