Skip to content

Commit ea6aa35

Browse files
vspinubbatsov
authored andcommitted
Fix broken evaluation in cljc files with one connection
1 parent 4867db8 commit ea6aa35

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Bugs Fixed
1010

11+
* Fix interactive evaluation in cljc buffers with only one connection.
1112
* [#2058](https://github.com/clojure-emacs/cider/pull/2058) Don't cache ns-forms in buffers with no such forms.
1213
* [#2057](https://github.com/clojure-emacs/cider/pull/2057) Use `cider--font-lock-ensure` for compatibility with Emacs 24.5.
1314

cider-client.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ at all."
268268
;; that TYPE, but ultimately allow any type.
269269
(cl-labels ((right-type-p (c type)
270270
(when (or (not type)
271+
(equal type "multi")
271272
(and (buffer-live-p c)
272273
(equal (cider--connection-type c) type)))
273274
c))

test/cider-client-tests.el

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,20 @@ SYMBOL is locally let-bound to the current buffer."
498498
(spy-on 'cider-connected-p :and-return-value nil)
499499
(spy-on 'clojure-expected-ns :and-return-value "clojure-expected-ns")
500500
(expect (cider-expected-ns "foo") :to-equal "clojure-expected-ns")))
501+
502+
(describe "cider-load-file"
503+
(it "works as expected in empty Clojure buffers"
504+
(spy-on 'cider-request:load-file :and-return-value nil)
505+
(with-connection-buffer "clj" b
506+
(with-temp-buffer
507+
(clojure-mode)
508+
(setq buffer-file-name (make-temp-name "tmp.clj"))
509+
(expect (lambda () (cider-load-buffer)) :not :to-throw)))))
510+
511+
(describe "cider-interactive-eval"
512+
(it "works as expected in empty Clojure buffers"
513+
(spy-on 'cider-nrepl-request:eval :and-return-value nil)
514+
(with-connection-buffer "clj" b
515+
(with-temp-buffer
516+
(clojure-mode)
517+
(expect (lambda () (cider-interactive-eval "(+ 1)")) :not :to-throw)))))

0 commit comments

Comments
 (0)