Skip to content

Commit

Permalink
Don't lose the CIDER session over TRAMP files
Browse files Browse the repository at this point in the history
Fixes #3250
  • Loading branch information
vemv committed Aug 15, 2023
1 parent 1d8687b commit 0b2dfaf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [#3331](https://github.com/clojure-emacs/cider/issues/3331): `cider-eval`: never jump to spurious locations, as sometimes conveyed by nREPL.
- [#3112](https://github.com/clojure-emacs/cider/issues/3112): Fix the CIDER `xref-find-references` backend to return correct filenames.
- [#3393](https://github.com/clojure-emacs/cider/issues/3393): recompute namespace info on each shadow-cljs recompilation or evaluation.
- [#3250](https://github.com/clojure-emacs/cider/issues/3250): don't lose the CIDER session over TRAMP files.
- Fix the `xref-find-definitions` CIDER backend to return correct filenames.
- Fix the `cider-xref-fn-deps` buttons to direct to the right file.
- Make TRAMP functionality work when using non-standard ports.
Expand Down
10 changes: 10 additions & 0 deletions cider-connection.el
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,14 @@ REPL defaults to the current REPL."
"Figure out if SESSION1 or SESSION2 is more relevant."
(sesman-more-recent-p (cdr session1) (cdr session2)))

(defun remove-string-prefix (prefix str)
"Remove PREFIX from the beginning of STR, if it is present.
Otherwise, return the original string."
(if (and (string-prefix-p prefix str)
(>= (length str) (length prefix)))
(substring str (length prefix))
str))

(declare-function cider-classpath-entries "cider-client")
(cl-defmethod sesman-friendly-session-p ((_system (eql CIDER)) session)
"Check if SESSION is a friendly session."
Expand All @@ -624,6 +632,8 @@ REPL defaults to the current REPL."
(when (string-match-p "#uzip" file)
(let ((avfs-path (directory-file-name (expand-file-name (or (getenv "AVFSBASE") "~/.avfs/")))))
(setq file (replace-regexp-in-string avfs-path "" file t t))))
(when-let ((tp (cider-tramp-prefix (current-buffer))))
(setq file (remove-string-prefix tp file)))
(when (process-live-p proc)
(let* ((classpath (or (process-get proc :cached-classpath)
(let ((cp (with-current-buffer repl
Expand Down

0 comments on commit 0b2dfaf

Please sign in to comment.