Function: isearch-search

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

Signature

(isearch-search)

Documentation

Do the search with the current search string.

Source Code

;; Defined in /usr/src/emacs/lisp/isearch.el.gz
(defun isearch-search ()
  "Do the search with the current search string."
  (if (and (eq isearch-case-fold-search t) search-upper-case)
      (setq isearch-case-fold-search
	    (isearch-no-upper-case-p isearch-string isearch-regexp)))
  (condition-case lossage
      (let ((inhibit-quit nil)
	    (case-fold-search isearch-case-fold-search)
	    (search-invisible isearch-invisible)
	    (retry t))
	(setq isearch-error nil)
	(while retry
	  (setq isearch-success
		(isearch-search-string isearch-string nil t))
	  ;; Clear RETRY unless the search predicate says
	  ;; to skip this search hit.
	  (if (or (not isearch-success)
		  (funcall isearch-filter-predicate
			   (match-beginning 0) (match-end 0)))
	      (setq retry nil)
	    ;; Advance point on empty matches before retrying
	    (when (= (match-beginning 0) (match-end 0))
	      (if (if isearch-forward (eobp) (bobp))
		  (setq retry nil isearch-success nil)
		(forward-char (if isearch-forward 1 -1))))))
	(setq isearch-just-started nil)
	(when isearch-success
	  (setq isearch-other-end
		(if isearch-forward (match-beginning 0) (match-end 0)))
          (setq isearch-match-data (match-data t))))

    (quit (isearch-unread ?\C-g)
	  (setq isearch-success nil))

    (invalid-regexp
     (setq isearch-error (car (cdr lossage)))
     (cond
      ((string-match
	"\\`Premature \\|\\`Unmatched "
	isearch-error)
       (setq isearch-error "incomplete input"))
      ((and (not isearch-regexp)
	    (string-match "\\`Regular expression too big" isearch-error))
       (cond
	(isearch-regexp-function
         (setq isearch-error nil)
         (setq isearch-regexp-function nil)
         (isearch-search-and-update)
         (isearch--momentary-message "Too many words; switched to literal mode" 2))
	((and isearch-lax-whitespace search-whitespace-regexp)
	 (setq isearch-error "Too many spaces for whitespace matching"))))))

    (search-failed
     (setq isearch-success nil)
     (setq isearch-error (nth 2 lossage)))

    (error
     ;; stack overflow in regexp search.
     (setq isearch-error (format "%s" lossage))))

  (unless isearch-success
    ;; Ding if failed this time after succeeding last time.
    (and (isearch--state-success (car isearch-cmds))
	 (not (eq isearch-wrap-pause 'no-ding))
	 (ding))
    (if (functionp (isearch--state-pop-fun (car isearch-cmds)))
        (funcall (isearch--state-pop-fun (car isearch-cmds))
                 (car isearch-cmds)))
    (goto-char (isearch--state-point (car isearch-cmds)))))