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.

If BOUNDS is non-nil, return a list of its starting and ending position instead.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-util.el
(defun cider-defun-at-point (&optional bounds)
  "Return the text of the top level sexp at point.
If BOUNDS is non-nil, return a list of its starting and ending position
instead."
  (save-excursion
    (save-match-data
      (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)))))