cider icon indicating copy to clipboard operation
cider copied to clipboard

cider-pop-back switches projects in some cases

Open daveliepmann opened this issue 5 years ago • 1 comments

I expect jump-to-definition (cider-find-var/M-.) and jump-back-to-where-I-was (cider-pop-back/M-,) to move up and down a dynamic stack of definitions, with each jump-back operation staying within the scope of each sequence of calls. But jumping back ignores the scope each "stack" of calls was made in, meaning that I am sent "back" to other projects if I M-, too far.

Expected behavior

Jump to definition from X to Y. Switch buffers to Q in another project. Jump to definition from Q to R. Jump back once (to Q). Now, imagine you've forgotten how far down the definition stack you are, so you try to jump back again. You go nowhere because your current context is QR, not XY.

Actual behavior

Jumping back from Q sends you to X.

Steps to reproduce the problem

Jump to definition in one buffer (elisp or Clojure(Script)). Manually switch buffers to another project. Jump to definition, then jump back twice.

Environment & Version information

CIDER version information

;; CIDER 0.23.0 (Lima), nREPL 0.6.0
;; Clojure 1.10.1, Java 11.0.2

Lein/Boot version

n/a

Emacs version

GNU Emacs 26.1 (build 1, x86_64-apple-darwin18.0.0, Carbon Version 158 AppKit 1671) of 2019-01-11

Operating system

MacOS Catalina 10.15.4 (19E287)

daveliepmann avatar May 10 '20 14:05 daveliepmann

I'll have to think about this. Right now cider-pop-back is just an alias for a built-in Emacs command that goes over all the locations that were saved. Potentially we can replace it with something that filters out locations that are not within the current project. I think that wouldn't be hard.

bbatsov avatar Jun 02 '20 07:06 bbatsov

CIDER in principle does not have the notion of a project.

It knows about Sesman sessions though.

It might make sense to prevent the pop if the destination buffers' repl is not equal (or friendly to) the current buffer.

I'm not sure we want to add that though. This seems a pretty minor problem to solve, with a risk greater than its benefit.

This would be a great advice-add IMO.

I'll close this issue, but feel free to continue the conversation (especially if you get to draft an advice-add).

Cheers - V

vemv avatar Oct 28 '23 21:10 vemv