Function: clojure-sexp-starts-until-position

clojure-sexp-starts-until-position is a byte-compiled function defined in clojure-mode.el.

Signature

(clojure-sexp-starts-until-position POSITION)

Documentation

Return the starting points for forms before POSITION.

Positions are in descending order to aide in finding the first starting position before the current position.

Source Code

;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defun clojure-sexp-starts-until-position (position)
  "Return the starting points for forms before POSITION.
Positions are in descending order to aide in finding the first starting
position before the current position."
  (save-excursion
    (let (sexp-positions)
      (condition-case nil
          (while (< (point) position)
            (clojure-forward-logical-sexp 1)
            (clojure-backward-logical-sexp 1)
            ;; Needed to prevent infinite recursion when there's only 1 form in buffer.
            (if (eq (point) (car sexp-positions))
                (goto-char position)
              (push (point) sexp-positions)
              (clojure-forward-logical-sexp 1)))
        (scan-error nil))
      sexp-positions)))