Function: cider-defun-at-point
cider-defun-at-point is a byte-compiled function defined in
cider-util.el.
Signature
(cider-defun-at-point &optional BOUNDS)
Documentation
Return the text of the top level sexp at point.
Inside a comment form the enclosed form is treated as the top level
one, so the whole CIDER command family (eval, pprint, inspect, debug,
format...) behaves consistently in rich-comment blocks - evaluating a
whole (comment ...) yields nil, which is never what anyone wants.
If BOUNDS is non-nil, return a list of its starting and ending position
instead.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-util.el
(defun cider-defun-at-point (&optional bounds)
"Return the text of the top level sexp at point.
Inside a `comment' form the enclosed form is treated as the top level
one, so the whole CIDER command family (eval, pprint, inspect, debug,
format...) behaves consistently in rich-comment blocks - evaluating a
whole `(comment ...)' yields nil, which is never what anyone wants.
If BOUNDS is non-nil, return a list of its starting and ending position
instead."
(save-excursion
(save-match-data
(let ((clojure-toplevel-inside-comment-form t)
(clojure-ts-toplevel-inside-comment-form t))
(if (derived-mode-p 'cider-repl-mode)
(goto-char (point-max)) ;; in repls, end-of-defun won't work, so we perform the closest reasonable thing
(end-of-defun))
(let ((end (point)))
(clojure-backward-logical-sexp 1)
(cider--text-or-limits bounds (point) end))))))