Skip to content

Commit 4839398

Browse files
yuhan0bbatsov
authored andcommitted
Fix eval-to-comment at eob
Defun bounds always include the following newline, except for the edge case at the end of buffer. This causes cider-eval-defun-to-comment to insert the comment at the end of line instead of on a new line.
1 parent 5f705b0 commit 4839398

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cider-eval.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,8 @@ COMMENT-POSTFIX is the text to output after the last line."
857857
(with-current-buffer buffer
858858
(save-excursion
859859
(goto-char (marker-position location))
860+
;; edge case: defun at eob
861+
(unless (bolp) (insert "\n"))
860862
(cider-maybe-insert-multiline-comment res comment-prefix continued-prefix comment-postfix)))
861863
(when cider-eval-register
862864
(set-register cider-eval-register res)))

0 commit comments

Comments
 (0)