Function: treesit--clip-ranges

treesit--clip-ranges is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit--clip-ranges RANGES START END)

Documentation

Clip RANGES in between START and END.

RANGES is a list of ranges of the form (BEG . END). Ranges outside of the region between START and END are thrown away, and those inside are kept.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
;; TODO: truncate ranges that exceeds START and END instead of
;; discarding them.  Merge into treesit--merge-ranges so we don't loop
;; over the ranges twice (might be premature optimization tho).
(defun treesit--clip-ranges (ranges start end)
  "Clip RANGES in between START and END.
RANGES is a list of ranges of the form (BEG . END).  Ranges
outside of the region between START and END are thrown away, and
those inside are kept."
  (cl-loop for range in ranges
           if (<= start (car range) (cdr range) end)
           collect range))