Skip to content

Commit b1a7f0e

Browse files
committed
Merge pull request #1519 from cap10morgan/v0.10
Bug fixes for 0.10.2
2 parents 93e061b + 6fc4556 commit b1a7f0e

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
# Changelog
22

3-
## 0.10.1 / (unreleased)
3+
## 0.10.2 / (unreleased)
4+
5+
### Changes
6+
7+
* `cider-current-connection` actually, really considers major mode before `cider-repl-type`.
8+
9+
### Bugs fixed
10+
11+
* [#1521](https://github.com/clojure-emacs/cider/pull/1521): Don't assume the repl buffer is in the current frame in `cider-repl--show-maximum-output`.
12+
13+
## 0.10.1 / 2015-01-05
414

515
### Changes
616

717
* Suppress eldoc when the current sexp seems to be too large.
818
* [#1500](https://github.com/clojure-emacs/cider/pull/1500): Improve the performance of REPL buffers by using text properties instead of overlays for ANSI coloring.
19+
* `cider-current-connection` considers major mode before `cider-repl-type`.
920

1021
### Bugs fixed
1122

cider-client.el

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,14 @@ such a link cannot be established automatically."
197197
(cider-ensure-connected)
198198
(kill-local-variable 'cider-connections))
199199

200+
(defun cider-connection-type-for-buffer ()
201+
"Return the matching connection type (clj or cljs) for the current buffer."
202+
(cond
203+
((derived-mode-p 'clojurescript-mode) "cljs")
204+
((derived-mode-p 'clojure-mode) "clj")
205+
(cider-repl-type)
206+
(t "clj")))
207+
200208
(defun cider-current-connection (&optional type)
201209
"Return the REPL buffer relevant for the current Clojure source buffer.
202210
A REPL is relevant if its `nrepl-project-dir' is compatible with the
@@ -218,9 +226,7 @@ from the file extension."
218226
;; Only one match, just return it.
219227
(car project-connections)
220228
;; OW, find one matching the language of the current buffer.
221-
(let ((type (or type cider-repl-type
222-
(if (derived-mode-p 'clojurescript-mode)
223-
"cljs" "clj"))))
229+
(let ((type (or type (cider-connection-type-for-buffer))))
224230
(or (seq-find (lambda (conn)
225231
(equal (cider--connection-type conn) type))
226232
project-connections)

cider-repl.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ This will not work on non-current prompts."
392392
(defun cider-repl--show-maximum-output ()
393393
"Put the end of the buffer at the bottom of the window."
394394
(when (eobp)
395-
(let ((win (get-buffer-window (current-buffer))))
395+
(let ((win (get-buffer-window (current-buffer) t)))
396396
(when win
397397
(with-selected-window win
398398
(set-window-point win (point-max))

test/cider-tests.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,21 @@
254254
(should (string= (cider--var-namespace "a-two/var") "a-two"))
255255
(should (string= (cider--var-namespace "a.two-three.b/var-c") "a.two-three.b")))
256256

257+
(ert-deftest test-cider-connection-type-for-buffer ()
258+
(with-temp-buffer
259+
(clojurescript-mode)
260+
(should (string= (cider-connection-type-for-buffer) "cljs")))
261+
(with-temp-buffer
262+
(clojure-mode)
263+
(should (string= (cider-connection-type-for-buffer) "clj")))
264+
(with-temp-buffer
265+
(let ((cider-repl-type nil))
266+
(should (string= (cider-connection-type-for-buffer) "clj")))
267+
(let ((cider-repl-type "clj"))
268+
(should (string= (cider-connection-type-for-buffer) "clj")))
269+
(let ((cider-repl-type "cljs"))
270+
(should (string= (cider-connection-type-for-buffer) "cljs")))))
271+
257272

258273
;;; response handling
259274
(ert-deftest test-cider-dbind-response ()

0 commit comments

Comments
 (0)