Function: org--re-list-search-forward

org--re-list-search-forward is a byte-compiled function defined in ol.el.gz.

Signature

(org--re-list-search-forward REGEXP-LIST &optional BOUND NOERROR COUNT)

Documentation

Like re-search-forward, but REGEXP-LIST is a list of regexps.

BOUND, NOERROR, and COUNT are passed to re-search-forward.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ol.el.gz
(defun org--re-list-search-forward (regexp-list &optional bound noerror count)
  "Like `re-search-forward', but REGEXP-LIST is a list of regexps.
BOUND, NOERROR, and COUNT are passed to `re-search-forward'."
  (let (result (min-found most-positive-fixnum)
               (pos-found nil)
               (min-found-data nil)
               (tail regexp-list))
    (while tail
      (setq result (save-excursion (re-search-forward (pop tail) bound t count)))
      (when (and result (< result min-found))
        (setq min-found result
              pos-found (match-end 0)
              min-found-data (match-data))))
    (if (= most-positive-fixnum min-found)
        (pcase noerror
          (`t nil)
          (_ (re-search-forward (car regexp-list) bound noerror count)))
      (set-match-data min-found-data)
      (goto-char pos-found))))