Function: evil-ex-search-find-next-pattern

evil-ex-search-find-next-pattern is a byte-compiled function defined in evil-search.el.

Signature

(evil-ex-search-find-next-pattern PATTERN &optional DIRECTION)

Documentation

Look for the next occurrence of PATTERN in a certain DIRECTION.

Note that this function ignores the whole-line property of PATTERN.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-search.el
(defun evil-ex-search-find-next-pattern (pattern &optional direction)
  "Look for the next occurrence of PATTERN in a certain DIRECTION.
Note that this function ignores the whole-line property of PATTERN."
  (setq direction (or direction 'forward))
  (let ((case-fold-search (evil-ex-pattern-ignore-case pattern)))
    (cond
     ((eq direction 'forward)
      (re-search-forward (evil-ex-pattern-regex pattern) nil t))
     ((eq direction 'backward)
      (let* ((pnt (point))
             (ret (re-search-backward (evil-ex-pattern-regex pattern) nil t))
             (m (and ret (match-data))))
        (if ret
            (forward-char)
          (goto-char (point-min)))
        (let ((fwdret
               (re-search-forward (evil-ex-pattern-regex pattern) nil t)))
          (cond
           ((and fwdret (< (match-beginning 0) pnt))
            (setq ret fwdret)
            (goto-char (match-beginning 0)))
           (ret
            (set-match-data m)
            (goto-char (match-beginning 0)))
           (t
            (goto-char pnt)
            ret)))))
     (t (user-error "Unknown search direction `%s'" direction)))))