cider

jumar 2025-02-22T04:56:43.379689Z

I often get a stacktrace (such as from a bug report) and would like to paste it somewhere in emacs and jump into specific places in code easily. How do you do that with cider? I thought that I could use cider-scratch and just paste the stacktrace there but "jump to definition" doesn't work with that approach.

Harold 2025-02-22T20:40:09.638999Z

This is an interesting question - I'd use some combination of projectile, ag (the silver searcher), and ctrlf for this. If the stack trace is just a string (copy/pasted from somewhere else like you mention), I guess we'd need a parser for it. cider-stacktrace-mode is presumably driven by the in-process/in-memory stacktrace data (not from the printed stacktrace string), so reconstituting that data would probably be a necessary step. A great example of why readable printed data is so valuable.

oyakushev 2025-02-26T10:23:00.588389Z

@jumar There is M-x cider-stacktrace-analyze-at-point for this. 1. Make a new text buffer and paste the stacktrace into it. 2. Enabled M-x cider-mode in the buffer. 3. Do M-x cider-stacktrace-analyze-at-point while pointing at the start of the stacktrace. 4. CIDER will pop up the interactive cider-stacktrace buffer where you can click the frames to jump to the code (this includes Java frames too). Instead of creating a new text buffer, you can somehow get the stacktrace printed in the REPL, but that's probably harder.

oyakushev 2025-02-26T10:25:35.706269Z

It doesn't seem overly reliably though; this is something I want to focus on soon.

jumar 2025-02-26T11:16:30.407109Z

Funny enough, now I'm able to paste a stacktrace into cider-scratch buffer and simply jump to a specified location via jump-to-definition (I use spacemacs). Before, perhaps that scratch buffer wasn't connected to the correct REPL session? think_beret