I want to instrument a function so that edebug gets control when that point is reached. I can insert (edebug) in the code, however, unless the function is instrumented with edebug (C-u M-S-x), that will be interpreted as (debug), which I don't want. But if the function is instrumented with edebug, then a break occurs everytime the function is called, not just when the particular point in the function is reached. I only want the break to occur (and get control with edebug) when a particular place in the function is reached.

  • c the first time to get to your breakpoint; g thereafter. – NickD May 31 at 21:16

Customize the user option C-hv edebug-initial-mode or use M-x edebug-set-initial-mode1 to set the value go instead of the default step.

In the absence of relevant breakpoints, an instrumented function will now simply run to completion without interruption.

Note that you can set breakpoints in an instrumented function with M-x edebug-set-breakpoint or M-x edebug-set-conditional-breakpoint, or using the C-xXC-h bindings, without the debugger being active at the time.

1 See C-hig (elisp)Edebug Execution Modes for the valid options.

In emacs-lisp-mode buffers (but not in the *scratch* buffer's lisp-interaction-mode, which seems like a bug) you also have the following GUD-style bindings available when edebug has been loaded:

C-x C-a C-c   edebug-go-mode
C-x C-a C-s   edebug-step-mode
C-x C-a C-n   edebug-next-mode
C-x C-a C-l   edebug-where

As well as this non-GUD binding under the same prefix:

C-x C-a RET   edebug-set-initial-mode


  • C-xC-aRETg -- change initial mode to go.
  • C-xC-aRETSPC -- change initial mode to step.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.