Function: isearch-search-fun-in-noncontiguous-region

isearch-search-fun-in-noncontiguous-region is a byte-compiled function defined in isearch.el.gz.

Signature

(isearch-search-fun-in-noncontiguous-region SEARCH-FUN BOUNDS)

Documentation

Return the function that searches inside noncontiguous regions.

A noncontiguous region is defined by the argument BOUNDS that is a list of cons cells of the form (START . END).

Source Code

;; Defined in /usr/src/emacs/lisp/isearch.el.gz
(defun isearch-search-fun-in-noncontiguous-region (search-fun bounds)
  "Return the function that searches inside noncontiguous regions.
A noncontiguous region is defined by the argument BOUNDS that
is a list of cons cells of the form (START . END)."
  (apply-partially
   #'search-within-boundaries
   search-fun
   (lambda (pos)
     (seq-some (lambda (b) (if isearch-forward
                               (and (>= pos (car b)) (< pos (cdr b)))
                             (and (> pos (car b)) (<= pos (cdr b)))))
               bounds))
   (lambda (pos)
     (let ((bounds (flatten-list bounds))
           found)
       (unless isearch-forward
         (setq bounds (nreverse bounds)))
       (while (and bounds (not found))
         (if (if isearch-forward (< pos (car bounds)) (> pos (car bounds)))
             (setq found (car bounds))
           (setq bounds (cdr bounds))))
       found))))