Function: isearch-repeat-backward

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

Signature

(isearch-repeat-backward &optional ARG)

Documentation

Repeat incremental search backwards.

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

View in manual

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