Function: replace-search

replace-search is a byte-compiled function defined in replace.el.gz.

Signature

(replace-search SEARCH-STRING LIMIT REGEXP-FLAG DELIMITED-FLAG CASE-FOLD &optional BACKWARD)

Documentation

Search for the next occurrence of SEARCH-STRING to replace.

Source Code

;; Defined in /usr/src/emacs/lisp/replace.el.gz
(defun replace-search (search-string limit regexp-flag delimited-flag
		       case-fold &optional backward)
  "Search for the next occurrence of SEARCH-STRING to replace."
  ;; Let-bind global isearch-* variables to values used
  ;; to search the next replacement.  These let-bindings
  ;; should be effective both at the time of calling
  ;; `isearch-search-fun-default' and also at the
  ;; time of funcalling `search-function'.
  ;; These isearch-* bindings can't be placed higher
  ;; outside of this function because then another I-search
  ;; used after `recursive-edit' might override them.
  (let* ((isearch-regexp regexp-flag)
	 (isearch-regexp-function (or replace-regexp-function
				      delimited-flag
				      (and replace-char-fold
					   (not regexp-flag)
					   #'char-fold-to-regexp)))
	 (isearch-lax-whitespace
	  replace-lax-whitespace)
	 (isearch-regexp-lax-whitespace
	  replace-regexp-lax-whitespace)
	 (isearch-case-fold-search case-fold)
	 (isearch-adjusted nil)
	 (isearch-nonincremental t)	; don't use lax word mode
	 (isearch-forward (not backward))
	 (search-function
	  (or (if regexp-flag
		  replace-re-search-function
		replace-search-function)
              ;; `isearch-search-fun' can't be used here because
              ;; when buffer-local `isearch-search-fun-function'
              ;; searches e.g. the minibuffer history, then
              ;; `query-replace' should not operate on the whole
              ;; history, but only on the minibuffer contents.
	      (isearch-search-fun-default))))
    (funcall search-function search-string limit t)))