W3cubDocs

/Elisp

Source Breakpoints

All breakpoints in a definition are forgotten each time you reinstrument it. If you wish to make a breakpoint that won’t be forgotten, you can write a source breakpoint, which is simply a call to the function edebug in your source code. You can, of course, make such a call conditional. For example, in the fac function, you can insert the first line as shown below, to stop when the argument reaches zero:

(defun fac (n)
  (if (= n 0) (edebug))
  (if (< 0 n)
      (* n (fac (1- n)))
    1))

When the fac definition is instrumented and the function is called, the call to edebug acts as a breakpoint. Depending on the execution mode, Edebug stops or pauses there.

If no instrumented code is being executed when edebug is called, that function calls debug.

Copyright © 1990-1996, 1998-2019 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
https://www.gnu.org/software/emacs/manual/html_node/elisp/Source-Breakpoints.html