Skip to content

Commit 8f8d7de

Browse files
committed
Fix cider-eval-pprint-with-multiline-comment-handler
The printed value is in the value slot, not the out or err slots. Accumulate the result in the value handler and insert the actual comment in the done handler.
1 parent d0e357a commit 8f8d7de

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

Diff for: .dir-locals.el

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
(cider--jack-in . 1)
2323
(cider--make-result-overlay . 1)
2424
;; need better solution for indenting cl-flet bindings
25-
(multiline-comment-handler . defun) ;; cl-flet
2625
(insert-label . defun) ;; cl-flet
2726
(insert-align-label . defun) ;; cl-flet
2827
(insert-rect . defun) ;; cl-flet

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* `cider-ns-save-files-on-refresh` will now save any modified buffers visiting files on the classpath, rather than just in the current project.
2727
* `cider-expected-ns` no longer requires an absolute path as its argument, and now internally handles paths canonically and consistently.
2828
* Fixed a bug causing REPL output to be inserted after the prompt.
29+
* Fixed a bug causing `cider-pprint-eval-last-sexp-to-comment` and `cider-pprint-eval-defun-to-comment` to not insert anything.
2930

3031
## 0.20.0 (2019-01-14)
3132

Diff for: cider-eval.el

+22-16
Original file line numberDiff line numberDiff line change
@@ -544,22 +544,28 @@ LOCATION is the location at which to insert.
544544
COMMENT-PREFIX is the comment prefix for the first line of output.
545545
CONTINUED-PREFIX is the comment prefix to use for the remaining lines.
546546
COMMENT-POSTFIX is the text to output after the last line."
547-
(cl-flet ((multiline-comment-handler (buffer value)
548-
(with-current-buffer buffer
549-
(save-excursion
550-
(goto-char location)
551-
(let ((lines (split-string value "[\n]+" t)))
552-
;; only the first line gets the normal comment-prefix
553-
(insert (concat comment-prefix (pop lines)))
554-
(dolist (elem lines)
555-
(insert (concat "\n" continued-prefix elem)))
556-
(unless (string= comment-postfix "")
557-
(insert comment-postfix)))))))
558-
(nrepl-make-response-handler buffer
559-
'()
560-
#'multiline-comment-handler
561-
#'multiline-comment-handler
562-
'())))
547+
(let ((res ""))
548+
(nrepl-make-response-handler
549+
buffer
550+
(lambda (_buffer value)
551+
(setq res (concat res value)))
552+
nil
553+
nil
554+
(lambda (buffer)
555+
(with-current-buffer buffer
556+
(save-excursion
557+
(goto-char location)
558+
(let ((lines (split-string res "[\n]+" t)))
559+
;; only the first line gets the normal comment-prefix
560+
(insert (concat comment-prefix (pop lines)))
561+
(dolist (elem lines)
562+
(insert (concat "\n" continued-prefix elem)))
563+
(unless (string= comment-postfix "")
564+
(insert comment-postfix))))))
565+
nil
566+
nil
567+
(lambda (_buffer warning)
568+
(setq res (concat res warning))))))
563569

564570
(defun cider-popup-eval-handler (&optional buffer)
565571
"Make a handler for printing evaluation results in popup BUFFER.

0 commit comments

Comments
 (0)