Next: , Previous: , Up: Debugging   [Contents][Index]


17.3 debug-on-quit and (debug)

In addition to setting debug-on-error or calling debug-on-entry, there are two other ways to start debug.

You can start debug whenever you type C-g (keyboard-quit) by setting the variable debug-on-quit to 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))

The debug function is described in detail in The Lisp Debugger in The GNU Emacs Lisp Reference Manual.

This page has generated for branch:work/add_lispintr, commit:65845cf60c073f2f3182d1d07483530e9bbe1d96 to check Japanese translation.