Skip to content

Commit 47d9a95

Browse files
committed
Make cider-repl-set-ns more reliable on Piggieback connections
Fixes #3503 Partially reverts 5f705b
1 parent d6a1ebb commit 47d9a95

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
- [#3250](https://github.com/clojure-emacs/cider/issues/3250): Don't lose the CIDER session over TRAMP files.
3838
- [#3413](https://github.com/clojure-emacs/cider/issues/3413): Make jump-to-definition work in projects needing `cider-path-translations` (i.e. Dockerized projects).
3939
- [#2436](https://github.com/clojure-emacs/cider/issues/2436): Prevent malformed `cider-repl-history-file`s from failing `cider-jack-in`.
40-
- [#3456](https://github.com/clojure-emacs/cider/issues/3456): restore xref-based jump-to-definition in Babashka (and any nREPL clients not having cider-nrepl).
40+
- [#3456](https://github.com/clojure-emacs/cider/issues/3456): Restore xref-based jump-to-definition in Babashka (and any nREPL clients not having cider-nrepl).
4141
- [#3466](https://github.com/clojure-emacs/cider/issues/3466): Restore usual `cider--connected-handler` performance for JVM Clojure repls.
42+
- [#3503](https://github.com/clojure-emacs/cider/issues/3503): Make `cider-repl-set-ns` more reliable on Piggieback connections.
4243
- Fix the `xref-find-definitions` CIDER backend to return correct filenames.
4344
- Fix the `cider-xref-fn-deps` buttons to direct to the right file.
4445
- Fix the `cider-find-keyword` overall reliability and correctness, particularly for ClojureScript.

cider-repl.el

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,8 +1321,15 @@ command will prompt for the name of the namespace to switch to."
13211321
;; That's why we eval them separately instead of combining them with `do'.
13221322
(when cider-repl-require-ns-on-set
13231323
(cider-sync-tooling-eval (format "(require '%s)" ns) nil connection))
1324-
(cider-tooling-eval (format "(in-ns '%s)" ns)
1325-
(cider-repl-switch-ns-handler connection)))))
1324+
(let ((f (if (equal 'cljs
1325+
(with-current-buffer connection
1326+
cider-repl-type))
1327+
;; For cljs, don't use cider-sync-tooling-eval, because Piggieback will later change the ns (issue #3503):
1328+
#'cider-nrepl-request:eval
1329+
;; When possible, favor cider-sync-tooling-eval because it preserves *1, etc (commit 5f705b):
1330+
#'cider-sync-tooling-eval)))
1331+
(funcall f (format "(in-ns '%s)" ns)
1332+
(cider-repl-switch-ns-handler connection))))))
13261333

13271334

13281335
;;; Location References

0 commit comments

Comments
 (0)