Function: cl--map-intervals

cl--map-intervals is an autoloaded and byte-compiled function defined in cl-extra.el.gz.

Signature

(cl--map-intervals FUNC &optional WHAT PROP START END)

Aliases

cl-map-intervals (obsolete since 24.3)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-extra.el.gz
;;;###autoload
(defun cl--map-intervals (func &optional what prop start end)
  (or what (setq what (current-buffer)))
  (if (bufferp what)
      (let (mark mark2 (next t) next2)
        (with-current-buffer what
          (setq mark (copy-marker (or start (point-min))))
          (setq mark2 (and end (copy-marker end))))
        (while (and next (or (not mark2) (< mark mark2)))
          (setq next (if prop (next-single-property-change
                               mark prop what)
                       (next-property-change mark what))
                next2 (or next (with-current-buffer what
                                 (point-max))))
          (funcall func (prog1 (marker-position mark)
                          (set-marker mark next2))
                   (if mark2 (min next2 mark2) next2)))
        (set-marker mark nil) (if mark2 (set-marker mark2 nil)))
    (or start (setq start 0))
    (or end (setq end (length what)))
    (while (< start end)
      (let ((next (or (if prop (next-single-property-change
                                start prop what)
                        (next-property-change start what))
                      end)))
        (funcall func start (min next end))
        (setq start next)))))