Function: cider--last-sexp-bounds

cider--last-sexp-bounds is a byte-compiled function defined in cider-util.el.

Signature

(cider--last-sexp-bounds)

Documentation

Return the bounds (BEG . END) of the sexp before point, or nil.

A forgiving wrapper around cider-last-sexp: it answers nil where that signals (unbalanced code) or where the answer is degenerate, which suits callers that want to fall back rather than fail.

Note that sexp motion no-ops at the start of a buffer, so there the answer is the *following* form. That quirk belongs to cider-last-sexp and is preserved here.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260920.725/cider-util.el
(defun cider--last-sexp-bounds ()
  "Return the bounds (BEG . END) of the sexp before point, or nil.
A forgiving wrapper around `cider-last-sexp': it answers nil where that
signals (unbalanced code) or where the answer is degenerate, which suits
callers that want to fall back rather than fail.

Note that sexp motion no-ops at the start of a buffer, so there the
answer is the *following* form.  That quirk belongs to `cider-last-sexp'
and is preserved here."
  (ignore-errors
    (pcase-let ((`(,beg ,end) (cider-last-sexp 'bounds)))
      (when (< beg end)
        (cons beg end)))))