Function: isearch-search-string

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

Signature

(isearch-search-string STRING BOUND NOERROR)

Documentation

Search for the first occurrence of STRING or its translation.

STRING's characters are translated using translation-table-for-input if that is non-nil. If found, move point to the end of the occurrence, update the match data, and return point. An optional second argument bounds the search; it is a buffer position. The match found must not extend after that position. Optional third argument, if t, means if fail just return nil (no error).
  If not nil and not t, move to limit of search and return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/isearch.el.gz
(defun isearch-search-string (string bound noerror)
  "Search for the first occurrence of STRING or its translation.
STRING's characters are translated using `translation-table-for-input'
if that is non-nil.
If found, move point to the end of the occurrence,
update the match data, and return point.
An optional second argument bounds the search; it is a buffer position.
The match found must not extend after that position.
Optional third argument, if t, means if fail just return nil (no error).
  If not nil and not t, move to limit of search and return nil."
  (let* ((func (isearch-search-fun))
         (pos1 (save-excursion (funcall func string bound noerror)))
         pos2)
    (when (and
	   ;; Avoid "obsolete" warnings for translation-table-for-input.
	   (with-no-warnings
	     (char-table-p translation-table-for-input))
	   (multibyte-string-p string)
	   ;; Minor optimization.
	   (string-match-p "[^[:ascii:]]" string))
      (let ((translated
             (apply 'string
                    (mapcar (lambda (c)
                              (or
			       ;; Avoid "obsolete" warnings for
			       ;; translation-table-for-input.
			       (with-no-warnings
				 (aref translation-table-for-input c))
			       c))
                            string)))
            match-data)
        (when translated
          (save-match-data
            (save-excursion
              (if (setq pos2 (funcall func translated bound noerror))
                  (setq match-data (match-data t)))))
          (when (and pos2
                     (or (not pos1)
                         (if isearch-forward (< pos2 pos1) (> pos2 pos1))))
            (setq pos1 pos2)
            (set-match-data match-data)))))
    (when pos1
      ;; When using multiple buffers isearch, switch to the new buffer here,
      ;; because `save-excursion' above doesn't allow doing it inside funcall.
      (when multi-isearch-next-buffer-current-function
        (multi-isearch-switch-buffer))
      (goto-char pos1)
      pos1)))