Skip to content

Conversation

alexander-yakushev
Copy link
Member

@alexander-yakushev alexander-yakushev commented Sep 23, 2025

This is the tock to nrepl/nrepl#391 's tick. These two PRs are enough to fix #946.

With the updated load-file in place, it now becomes possible to correctly instrument functions with #dbg and other debug-related reader tags when doing C-c C-k. I thought it was gonna be trivial from here but woe is me. First of all, I wanted to drop the old approach of double-reading the code. It's ugly. The forms are now only read once by the interruptible-eval loop, just like the gods intended. We pass a custom read function for that because:

  • We want to also capture the string underlying the form. This string is necessary for the client (Emacs) to verify that the code buffer didn't change after the instrumentation and the debugger can be shown inline or that a new debug-buffer needs to be created.
  • We use the metadata on the form as a vessel to pass extra data to the instrumentation machinery.

Re: capturing the form source code. This proved to be PITA. See comment-trimming-read+string.

Of course, the debugger has to continue working with older nREPLs down to 1.0.0. That's why all the older code remained, and I only introduced the new path for the new nREPL.

What else can I say? This crap works now, I sincerely hated doing this, gg go next.


  • You've added tests to cover your change(s)
  • You've updated the README

Copy link
Member

@bbatsov bbatsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reader tags like #dbg aren't respected when loading an entire file
2 participants