Function: avy--regex-candidates

avy--regex-candidates is a byte-compiled function defined in avy.el.

Signature

(avy--regex-candidates REGEX &optional BEG END PRED GROUP)

Documentation

Return all elements that match REGEX.

Each element of the list is ((BEG . END) . WND) When PRED is non-nil, it's a filter for matching point positions. When GROUP is non-nil, (BEG . END) should delimit that regex group.

Source Code

;; Defined in ~/.emacs.d/elpa/avy-20241101.1357/avy.el
(defun avy--regex-candidates (regex &optional beg end pred group)
  "Return all elements that match REGEX.
Each element of the list is ((BEG . END) . WND)
When PRED is non-nil, it's a filter for matching point positions.
When GROUP is non-nil, (BEG . END) should delimit that regex group."
  (setq group (or group 0))
  (let ((case-fold-search (or avy-case-fold-search
                              (string= regex (downcase regex))))
        candidates)
    (avy-dowindows current-prefix-arg
      (dolist (pair (avy--find-visible-regions
                     (or beg (window-start))
                     (or end (window-end (selected-window) t))))
        (save-excursion
          (goto-char (car pair))
          (while (re-search-forward regex (cdr pair) t)
            (when (avy--visible-p (1- (point)))
              (when (or (null pred)
                        (funcall pred))
                (push (cons
                       (if (numberp group)
                           (cons (match-beginning group)
                                 (match-end group))
                         (funcall group))
                       wnd) candidates)))))))
    (nreverse candidates)))