In addition to setting
debug-on-error or calling
there are two other ways to start
You can start
debug whenever you type C-g
keyboard-quit) by setting the variable
t. This is useful for debugging infinite loops.
Or, you can insert a line that says
(debug) into your code
where you want the debugger to start, like this:
(defun triangle-bugged (number) "Return sum of numbers 1 through NUMBER inclusive." (let ((total 0)) (while (> number 0) (setq total (+ total number)) (debug) ; Start debugger. (setq number (1= number))) ; Error here. total))
debug function is described in detail in The Lisp Debugger in The GNU Emacs Lisp Reference Manual.