Many languages have a mechanism to signal an attached debugger to pause or break. For example in JavaScript this is done using the debugger keyword. In others like C# or Visual Basic the signal is generated by a built-in function. This functionality is useful in situations where it is difficult or impossible to set breakpoints using the debugger.

Does elisp have an equivalent?

  • Just add (debug) to your code [Ref]. – Kaushal Modi Jun 9 '16 at 3:47
  • Also have a look at debug-on-message variable. Does edebug not help you in your use case? – Kaushal Modi Jun 9 '16 at 3:49
  • facepalm Thanks :-) debug-on-message looks neat! I seem to have encountered functions instrumented by edebug-defun not pausing in the debugger in certain contexts. I'll create a separate question if the mystery persists. – ebpa Jun 9 '16 at 4:01
  • I'm unsure of the proper etiquette here, but as the Q creator I believe I'm entitled to apply arbitrary answer selection criteria. @KaushalModi If you add an equivalent answer to your comment I'll mark it as answered. If you would like to defer to Stefan's answer (which was made after your comment) I'll mark his. In either case the "Explicit Debug" link should be included. – ebpa Jun 9 '16 at 4:09
  • No worries. Mark Stefan's answer as the answer :). You can ask him to add that link to his answer so that other users get a lead to learn more about this. – Kaushal Modi Jun 9 '16 at 4:13

Add (debug) and you'll be thrown into a buffer showing you the backtrace and where you can examine the current state.

See: Emacs Manual "Explicit Entry to the Debugger"

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.