Skip to content

Commit ec7b3f7

Browse files
committed
Merge pull request #1483 from cap10morgan/v0.10
Backported fixes for a 0.10.1 release
2 parents d4ecb92 + 723c335 commit ec7b3f7

File tree

6 files changed

+35
-17
lines changed

6 files changed

+35
-17
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
## master (unreleased)
44

5+
## 0.10.1 / (unreleased)
6+
7+
### Bugs fixed
8+
9+
* [#1480](https://github.com/clojure-emacs/cider/issues/1480): Fix an error in `cider-restart` caused by not using the REPL's buffer as the current connection when calling `cider-current-connection` from REPL buffer.
10+
* [#1450](https://github.com/clojure-emacs/cider/pull/1450): Fix an error in `cider-restart` caused by a reference to a killed buffer.
11+
* [#1459](https://github.com/clojure-emacs/cider/issues/1459): Add support for dynamic dispatch in scratch buffers.
12+
* [#1466](https://github.com/clojure-emacs/cider/issues/1466): Correctly font-lock pretty-printed results in the REPL.
13+
* [#1475](https://github.com/clojure-emacs/cider/pull/1475): Fix `args-out-of-range` error in `cider--get-symbol-indent`.
14+
515
## 0.10.0 / 2015-12-03
616

717
### New features
@@ -51,7 +61,7 @@
5161

5262
### Changes
5363

54-
* [#1299]https://github.com/clojure-emacs/cider/issues/1299 <kbd>C-c C-k</kbd> and <kbd> C-c C-l</kbd> now dispatch to both the Clojure and ClojureScript REPL (in the same project) when called from a `.cljc` or `.cljx` file.
64+
* [#1299](https://github.com/clojure-emacs/cider/issues/1299) <kbd>C-c C-k</kbd> and <kbd> C-c C-l</kbd> now dispatch to both the Clojure and ClojureScript REPL (in the same project) when called from a `.cljc` or `.cljx` file.
5565
* [#1397](https://github.com/clojure-emacs/cider/issues/1297) <kbd>C-c M-n</kbd> now changes the ns of both the Clojure and ClojureScript REPL (in the same project) when called from a cljc or cljx file.
5666
* [#1348](https://github.com/clojure-emacs/cider/issues/1348): Drop the dash dependency.
5767
* The usage of the default connection has been reduced significantly. Now evaluations & related commands will be routed via the connection matching the current project automatically unless there's some ambiguity when determining the connection (like multiple or no matching connections). Simply put you'll no longer have to mess around much with connecting-setting commands (e.g. `nrepl-connection-browser`, `cider-rotate-default-connection`).

cider-client.el

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,26 +204,28 @@ current directory (see `cider-find-connection-buffer-for-project-directory').
204204
If there is ambiguity, it is resolved by matching TYPE with the REPL
205205
type (Clojure or ClojureScript). TYPE is a string, which when nil is derived
206206
from the file extension."
207-
(cider-connections) ; Cleanup the connections list.
208-
(if (eq cider-request-dispatch 'dynamic)
207+
;; if you're in a REPL buffer, it's the connection buffer
208+
(if (derived-mode-p 'cider-repl-mode)
209+
(current-buffer)
210+
(let ((connections (cider-connections)))
209211
(cond
210-
((and (not type) (cider--in-connection-buffer-p)) (current-buffer))
211-
((= 1 (length cider-connections)) (car cider-connections))
212+
((eq cider-request-dispatch 'static) (car connections))
213+
((= 1 (length connections)) (car connections))
212214
(t (let ((project-connections
213215
(cider-find-connection-buffer-for-project-directory
214216
nil :all-connections)))
215217
(if (= 1 (length project-connections))
216218
;; Only one match, just return it.
217219
(car project-connections)
218-
;; OW, find one matching the extension of current file.
219-
(let ((type (or type (file-name-extension (or (buffer-file-name) "")))))
220+
;; 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"))))
220224
(or (seq-find (lambda (conn)
221225
(equal (cider--connection-type conn) type))
222226
project-connections)
223227
(car project-connections)
224-
(car cider-connections)))))))
225-
;; TODO: Add logic to dispatch to a matching Clojure/ClojureScript REPL based on file type
226-
(car cider-connections)))
228+
(car connections))))))))))
227229

228230
(defun cider-other-connection (&optional connection)
229231
"Return the first connection of another type than CONNECTION

cider-interaction.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,12 +1553,13 @@ and all ancillary CIDER buffers."
15531553

15541554
(defun cider--restart-connection (conn)
15551555
"Restart the connection CONN."
1556-
(let ((project-dir (with-current-buffer conn nrepl-project-dir)))
1556+
(let ((project-dir (with-current-buffer conn nrepl-project-dir))
1557+
(buf-name (buffer-name conn)))
15571558
(cider--quit-connection conn)
15581559
;; Workaround for a nasty race condition https://github.com/clojure-emacs/cider/issues/439
15591560
;; TODO: Find a better way to ensure `cider-quit' has finished
15601561
(message "Waiting for CIDER connection %s to quit..."
1561-
(cider-propertize-bold (buffer-name conn)))
1562+
(cider-propertize-bold buf-name))
15621563
(sleep-for 2)
15631564
(if project-dir
15641565
(let ((default-directory project-dir))

cider-mode.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ Returns to the buffer in which the command was invoked."
289289
;; There's no indent metadata, but there might be a clojure-mode
290290
;; indent-spec with fully-qualified namespace.
291291
(when (string-match cider-resolve--prefix-regexp symbol-name)
292-
(when-let ((sym (intern-soft (replace-match (cider-resolve-alias ns (match-string 1 symbol-name))
292+
(when-let ((sym (intern-soft (replace-match (save-match-data
293+
(cider-resolve-alias ns (match-string 1 symbol-name)))
293294
t t symbol-name 1))))
294295
(get sym 'clojure-indent-function))))))
295296

cider-repl.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,10 @@ the symbol."
606606
(lambda (buffer err)
607607
(cider-repl-emit-stderr buffer err))
608608
(lambda (buffer)
609-
(cider-repl-emit-prompt buffer))))
609+
(cider-repl-emit-prompt buffer))
610+
nrepl-err-handler
611+
(lambda (buffer pprint-out)
612+
(cider-repl-emit-result buffer pprint-out nil))))
610613

611614
(defun cider-repl--send-input (&optional newline)
612615
"Go to the end of the input and send the current input.

nrepl-client.el

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,8 @@ It is safe to call this function multiple times on the same ID."
824824

825825
(defun nrepl-make-response-handler (buffer value-handler stdout-handler
826826
stderr-handler done-handler
827-
&optional eval-error-handler)
827+
&optional eval-error-handler
828+
pprint-out-handler)
828829
"Make a response handler for connection BUFFER.
829830
A handler is a function that takes one argument - response received from
830831
the server process. The response is an alist that contains at least 'id'
@@ -855,8 +856,8 @@ server responses."
855856
(when stdout-handler
856857
(funcall stdout-handler buffer out)))
857858
(pprint-out
858-
(when stdout-handler
859-
(funcall stdout-handler buffer pprint-out)))
859+
(cond (pprint-out-handler (funcall pprint-out-handler buffer pprint-out))
860+
(stdout-handler (funcall stdout-handler buffer pprint-out))))
860861
(err
861862
(when stderr-handler
862863
(funcall stderr-handler buffer err)))

0 commit comments

Comments
 (0)