Function: cider-jump-to-comment

cider-jump-to-comment is an interactive and byte-compiled function defined in cider-eval.el.

Signature

(cider-jump-to-comment)

Documentation

Move point into the namespace's rich comment block.

Jump to the last top-level comment form in the buffer, creating an empty one at the end of the buffer when there is none. The previous location is pushed onto the mark ring, so C-u (universal-argument) C-SPC (set-mark-command) returns to it.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eval.el
(defun cider-jump-to-comment ()
  "Move point into the namespace's rich `comment' block.
Jump to the last top-level `comment' form in the buffer, creating an empty one
at the end of the buffer when there is none.  The previous location is pushed
onto the mark ring, so \\[universal-argument] \\[set-mark-command] returns to it."
  (interactive)
  (let ((bounds (cider--last-comment-form-bounds)))
    (push-mark)
    (if bounds
        ;; land at the end of the block's contents, where the next experiment
        ;; would go
        (progn
          (goto-char (1- (cdr bounds)))
          (skip-chars-backward " \t\n"))
      ;; no block yet: create an empty one and land inside it (the inserted
      ;; text is already correctly indented)
      (goto-char (point-max))
      (skip-chars-backward " \t\n")
      (delete-region (point) (point-max))
      (insert "\n\n(comment\n  )")
      (search-backward ")"))
    (when (get-buffer-window (current-buffer))
      (recenter))))