Make `cider-find-file` to do a bit more work in finding the stacktrace file.

Try your best to find the file even if the file is relative. The last resort measure is to iterate through clojure buffers and expand the file in each of those till an existing file has been found. 

This fixes #740 on emacs side by using the relative files provided in stacktrace. Even if #740 is fixed on nrepl side I think this patch doesn't harm and might prove useful in other circumstances.

Based on #761.
Performance is not really an issue here as we’re talking about a very fast operation. Unless something is performance critical I prefer better clarity over better performance. Also - I try to keep the codebase more approachable to Clojure developers and I generally avoid `cl-lib` constructs in favour of `dash.el` constructs.

—
Cheers, 
Bozhidar

On September 3, 2014 at 12:11:42 PM, Vitalie Spinu (notifications@github.com) wrote:

In cider-interaction.el:

> @@ -639,7 +642,14 @@ path or an entry within a zip/jar archive."
>                       (setq-local buffer-read-only t)
>                       (set-buffer-modified-p nil)
>                       (set-auto-mode)
> -                     (current-buffer))))))))
> +                     (current-buffer))))))
> +        (t (-if-let (path (cider--file-path url))
> +               (find-file-noselect path)
> +             (cl-loop for bf in (buffer-list)
We already have a helper in cider-util that returns the list of clojure buffers.

I didn't use it intentionally because it filters through all the bufers first. The cl loop returns once it stumbles on the right buffer, which is commonly on top of the list.

—
Reply to this email directly or view it on GitHub.