Function: replace--region-filter

replace--region-filter is a byte-compiled function defined in replace.el.gz.

Signature

(replace--region-filter BOUNDS)

Documentation

Return a function that decides if a region is inside BOUNDS.

BOUNDS is a list of cons cells of the form (START . END). The returned function takes as argument two buffer positions, START and END.

Source Code

;; Defined in /usr/src/emacs/lisp/replace.el.gz
(defun replace--region-filter (bounds)
  "Return a function that decides if a region is inside BOUNDS.
BOUNDS is a list of cons cells of the form (START . END).  The
returned function takes as argument two buffer positions, START
and END."
  (let ((region-bounds
         (mapcar (lambda (position)
                   (cons (copy-marker (car position))
                         (copy-marker (cdr position))))
                 bounds)))
    (lambda (start end)
      (delq nil (mapcar
                 (lambda (bounds)
                   (and
                    (>= start (car bounds))
                    (<= start (cdr bounds))
                    (>= end   (car bounds))
                    (<= end   (cdr bounds))))
                 region-bounds)))))