Function: cider--last-comment-form-bounds

cider--last-comment-form-bounds is a byte-compiled function defined in cider-eval.el.

Signature

(cider--last-comment-form-bounds)

Documentation

Return the bounds of the last top-level comment form in the buffer.

The return value is a cons (BEG . END), or nil when the buffer has no top-level comment form.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eval.el
(defun cider--last-comment-form-bounds ()
  "Return the bounds of the last top-level `comment' form in the buffer.
The return value is a cons (BEG . END), or nil when the buffer has no
top-level `comment' form."
  (save-excursion
    (goto-char (point-max))
    (let (beg)
      (while (and (not beg)
                  (re-search-backward "^(comment\\_>" nil t))
        ;; ignore matches that sit inside a string or a line comment
        (unless (ppss-comment-or-string-start (syntax-ppss))
          (setq beg (point))))
      (when beg
        (goto-char beg)
        (cons beg (progn (forward-sexp) (point)))))))