Function: isearch-repeat-forward

isearch-repeat-forward is an interactive and byte-compiled function defined in isearch.el.gz.

Signature

(isearch-repeat-forward &optional ARG)

Documentation

Repeat incremental search forwards.

With a numeric argument, repeat the search ARG times. A negative argument searches backwards. This command finds the next relative occurrence of the current search string. To find the absolute occurrence from the beginning of the buffer, type M-s M-< (isearch-beginning-of-buffer) with a numeric argument.

Probably introduced at or before Emacs version 27.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/isearch.el.gz
(defun isearch-repeat-forward (&optional arg)
  "Repeat incremental search forwards.
With a numeric argument, repeat the search ARG times.
A negative argument searches backwards.
\\<isearch-mode-map>
This command finds the next relative occurrence of the current
search string.  To find the absolute occurrence from the beginning
of the buffer, type \\[isearch-beginning-of-buffer] with a numeric argument."
  (interactive "P")
  (if arg
      (let ((count (prefix-numeric-value arg)))
        (cond ((< count 0)
               (isearch-repeat-backward (abs count))
               ;; Reverse the direction back
               (let ((isearch-repeat-on-direction-change nil))
                 (isearch-repeat 'forward)))
              (t
               ;; Take into account one iteration to reverse direction
               (unless isearch-repeat-on-direction-change
                 (when (not isearch-forward) (setq count (1+ count))))
               (isearch-repeat 'forward count))))
    (isearch-repeat 'forward)))