clojure-emacs / cider Public
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
cider--xref-backend returns incorrect relative filenames for references #3112
Comments
|
Hi! Thanks for the report. Can you please also include one of the (presumed) problematic filenames? |
|
Sure, |
|
I meant, what exact value is CIDER handling that you believe is problematic. When you say |
|
aha, ok |
|
Thanks! I don't believe we have changed filename handling, there was https://github.com/clojure-emacs/orchard/pull/139/files but we explicitly made sure to not change sematics.
This calls my attention. Who is responsible for setting this? Could a better value be an absolute dirname ending in |
|
As far as I understand this is handled by emacs builtin xref functionality. |
|
ooops, sorry |
|
Thanks. It sounds off to me, There should be hanlding for source dirs other than I'm not really familiar with this section of cider.el, simply leaving these notes in case they help. |
(defun xref--show-xref-buffer (fetcher alist)
(cl-assert (functionp fetcher))
(let* ((xrefs
(or
(assoc-default 'fetched-xrefs alist)
(funcall fetcher)))
(xref-alist (xref--analyze xrefs))
(dd default-directory))
(with-current-buffer (get-buffer-create xref-buffer-name)
(setq default-directory dd)
(xref--xref-buffer-mode)
(xref--show-common-initialize xref-alist fetcher alist)
(pop-to-buffer (current-buffer))
(current-buffer))))It looks like the directory of xref buffer is inherited from the current buffer, so it seems like the only way is to provide an absolute file name for references. |
|
I guess should be an easy fix. Admittedly I didn't test the xref backend as much as I wanted to. |
|
I hope so, skimming through the sources I haven't find the notion of "project sources root". I believe it is somewhere in nrepl middleware. |
|
That's actually a resource URL, but I think that somewhere we have the absolute paths as well. |


Expected behavior
xref-find-references with cider backend must return either absolute file name or the name relative to the file of the current buffer.
Actual behavior
the file name returned is realtive to src directory and, as a result, selecting a reference in xref buffer doesn't work.
Steps to reproduce the problem
Put a cursor to some function in a clojure buffer, invoke xref-find-references. Try to select some of the candidates in the xref window.
Environment & Version information
CIDER version information
Emacs version
GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4)
of 2021-03-26
Operating system
Arch Linux
The text was updated successfully, but these errors were encountered: