Function: cider-last-sexp

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

Signature

(cider-last-sexp &optional BOUNDS)

Documentation

Return the sexp preceding the point.

If BOUNDS is non-nil, return a list of its starting and ending position instead. A line comment before point is skipped over rather than read as code.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260920.725/cider-util.el
(defun cider-last-sexp (&optional bounds)
  "Return the sexp preceding the point.
If BOUNDS is non-nil, return a list of its starting and ending position
instead.
A line comment before point is skipped over rather than read as code."
  (apply (if bounds #'list #'buffer-substring-no-properties)
         (save-excursion
           (cider--skip-back-over-comment)
           (clojure-backward-logical-sexp 1)
           (list (point)
                 (if (looking-at-p "\\s<")
                     ;; nothing but comments behind us; walking forward from
                     ;; here would hand back the comment as if it were code
                     (point)
                   (progn (clojure-forward-logical-sexp 1)
                          (point)))))))