Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse buffer when jumping to jar #981

Closed
expez opened this issue Feb 20, 2015 · 5 comments · Fixed by #982
Closed

Reuse buffer when jumping to jar #981

expez opened this issue Feb 20, 2015 · 5 comments · Fixed by #982

Comments

@expez
Copy link
Member

expez commented Feb 20, 2015

If you jump twice into the same file in a jar cider will ask something akin to "A buffer visiting jar://path/to/my/file.clj already exists. Proceed?" If you hit yes a new buffer is created, if you hit no the jump is cancelled. Instead of creating new buffers cider should just pop to the existing buffer.

@cichli
Copy link
Member

cichli commented Feb 20, 2015

Hmm, I don't get this. Do you have any config that automatically renames buffers? cider-find-file is calling get-file-buffer here. From the docs for get-file-buffer:

Return the buffer visiting file FILENAME (a string).
The buffer's `buffer-file-name' must match exactly the expansion of FILENAME.

Perhaps we should be using find-buffer-visiting?

Return the buffer visiting file FILENAME (a string).
This is like `get-file-buffer', except that it checks for any buffer
visiting the same file, possibly under a different name.

@expez
Copy link
Member Author

expez commented Feb 21, 2015

I certainly have some stuff that renames buffers, like uniquify, but since cider-find-file operates on the buffer-file-name I'm not sure if that's it.

I changed to find-buffer-visiting and that took care of the problem.

@cichli
Copy link
Member

cichli commented Feb 21, 2015

Ah, I misread the buffer-file-name bit in the docstring completely. What are the values of buffer-file-name and buffer-file-truename in the buffer in question? For reference I get:

"/Users/griffithsm/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar:clojure/core.clj"
"~/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar:clojure/core.clj"

Regardless, I think it makes sense to use find-buffer-visiting, and will open a PR accordingly.

@expez
Copy link
Member Author

expez commented Feb 21, 2015

buffer-file-name gives me an absolute path similar to the first of your examples. There is no buffer-file-truename (I can only find file-truename) built into emacs 24.4.

Thanks for making a pull request! 👍

@cichli
Copy link
Member

cichli commented Feb 21, 2015

Are you only looking at functions? It's a buffer-local variable :). https://www.gnu.org/software/emacs/manual/html_node/elisp/Buffer-File-Name.html

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 a pull request may close this issue.

2 participants