Function: evil-ex-search

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

Signature

(evil-ex-search &optional COUNT)

Documentation

Search forward or backward COUNT times for the current Ex search pattern.

The search pattern is determined by evil-ex-search-pattern, and the direction by evil-ex-search-direction.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-search.el
(defun evil-ex-search (&optional count)
  "Search forward or backward COUNT times for the current Ex search pattern.
The search pattern is determined by `evil-ex-search-pattern', and the
direction by `evil-ex-search-direction'."
  (setq evil-ex-search-start-point (point)
        evil-ex-last-was-search t
        count (or count 1))
  (let ((orig (point))
        wrapped)
    (dotimes (_ (or count 1))
      (when (and (eq evil-ex-search-direction 'forward) (not (eobp)))
        (forward-char)
        ;; maybe skip end-of-line
        (and (not evil-move-beyond-eol) (eolp) (not (eobp))
             (forward-char)))
      (let ((res (evil-ex-find-next nil nil (not evil-search-wrap))))
        (cond
         ((not res)
          (goto-char orig)
          (signal 'search-failed
                  (list (evil-ex-pattern-regex evil-ex-search-pattern))))
         ((eq res 'wrapped) (setq wrapped t)))))
    (if wrapped
        (let (message-log-max)
          (when evil-search-wrap-ring-bell (ding))
          (message "Search wrapped")))
    (goto-char (match-beginning 0))
    (setq evil-ex-search-match-beg (match-beginning 0)
          evil-ex-search-match-end (match-end 0))
    (evil-ex-search-goto-offset evil-ex-search-offset)
    (evil-ex-search-activate-highlight evil-ex-search-pattern)))