Function: elisp-refs--sexp-positions
elisp-refs--sexp-positions is a byte-compiled function defined in
elisp-refs.el.
Signature
(elisp-refs--sexp-positions BUFFER START-POS END-POS)
Documentation
Return a list of start and end positions of all the sexps between START-POS and END-POS (inclusive) in BUFFER.
Positions exclude quote characters, so given 'foo or foo, we
report the position of the symbol foo.
Not recursive, so we don
Source Code
;; Defined in ~/.emacs.d/elpa/elisp-refs-20230920.201/elisp-refs.el
(defun elisp-refs--sexp-positions (buffer start-pos end-pos)
"Return a list of start and end positions of all the sexps
between START-POS and END-POS (inclusive) in BUFFER.
Positions exclude quote characters, so given 'foo or `foo, we
report the position of the symbol foo.
Not recursive, so we don't consider subelements of nested sexps."
(let ((positions nil))
(with-current-buffer buffer
(condition-case _err
(catch 'done
(while t
(let* ((sexp-end-pos (let ((parse-sexp-ignore-comments t))
(scan-sexps start-pos 1))))
;; If we've reached a sexp beyond the range requested,
;; or if there are no sexps left, we're done.
(when (or (null sexp-end-pos) (> sexp-end-pos end-pos))
(throw 'done nil))
;; Otherwise, this sexp is in the range requested.
(push (list (elisp-refs--start-pos sexp-end-pos) sexp-end-pos)
positions)
(setq start-pos sexp-end-pos))))
;; Terminate when we see "Containing expression ends prematurely"
(scan-error nil)))
(nreverse positions)))