0

Has anyone found any way to step through the code using edebug and see how variables change on each step in the backtrace? On my emacs each time you run edebug-next-mode backtrace disappears and you have to invoke it again, which quickly turns into a difficult workflow.

5
  • Have you tried using the ordinary Emacs Lisp debugger instead of edebug? Maybe that will help.
    – Drew
    Jun 9 at 20:02
  • Thanks, I am trying to find out why one variable changes from its initial state and it's really hard without a way to track it. If you knew a good resource which explains how to set a breakpoint, step and track the variables that would be really helpful. I found edebug much easier to start with and couldn't find anything for the regular debugger. Jun 9 at 20:10
  • 1
    Maybe try function add-variable-watcher? (Never tried, myself.)
    – Drew
    Jun 10 at 3:13
  • Thank you very much, although I couldn't find add-variable-watcher function in my emacs, it led me to another function called debug-on-variable-change and what looks like a fantastic resource on doom emacs in general: emacsdocs.org/docs/elisp/Variable-Debugging Jun 10 at 12:11
  • Yes, add-variable-watcher and related functions were added in Emacs 28, I think.
    – Drew
    Jun 10 at 14:34

1 Answer 1

0

As a poor man's workaround I've rebound d to open backtrace and go back to the main window (so by pressing quickly n for next-mode and d for this funciton with a bit of flickering you can somewhat step through AND have a traceback):

(defun edebug-pop-to-backtrace-and-return ()
        (interactive)
        (edebug-pop-to-backtrace)
        (windmove-up))

(map! :map edebug-mode-map "d" 'edebug-pop-to-backtrace-and-return)

This is by not means a solution. If anyone found a better way to do it please let me know.

UPDATE: This won't work if you also want to watch local variables. Still looking for a "proper" solution...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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