Function: rx--condense-intervals

rx--condense-intervals is a byte-compiled function defined in rx.el.gz.

Signature

(rx--condense-intervals INTERVALS)

Documentation

Merge adjacent and overlapping intervals by mutation, preserving the order.

INTERVALS is a list of (START . END) with START ≤ END, sorted by START.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/rx.el.gz
(defun rx--condense-intervals (intervals)
  "Merge adjacent and overlapping intervals by mutation, preserving the order.
INTERVALS is a list of (START . END) with START ≤ END, sorted by START."
  (let ((tail intervals)
        d)
    (while (setq d (cdr tail))
      (if (>= (cdar tail) (1- (caar d)))
          (progn
            (setcdr (car tail) (max (cdar tail) (cdar d)))
            (setcdr tail (cdr d)))
        (setq tail d)))
    intervals))