branch: elpa/cider
commit 48393984825532df25649231e56dc3b0ab11dc3d
Author: yuhan0 <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    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.
---
 cider-eval.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cider-eval.el b/cider-eval.el
index a5e7c04c59..5ea02b21e1 100644
--- a/cider-eval.el
+++ b/cider-eval.el
@@ -857,6 +857,8 @@ COMMENT-POSTFIX is the text to output after the last line."
        (with-current-buffer buffer
          (save-excursion
            (goto-char (marker-position location))
+           ;; edge case: defun at eob
+           (unless (bolp) (insert "\n"))
            (cider-maybe-insert-multiline-comment res comment-prefix 
continued-prefix comment-postfix)))
        (when cider-eval-register
          (set-register cider-eval-register res)))

Reply via email to