6 (define-condition search-failed
(lice-condition)
7 () (:documentation
"raised when a search failed to match"))
9 (defun search-forward (string &optional bound noerror
(count 1))
10 "Search forward from point for string.
11 Set point to the end of the occurrence found, and return point.
12 An optional second argument bounds the search; it is a buffer position.
13 The match found must not extend after that position. nil is equivalent
15 Optional third argument, if t, means if fail just return nil (no error).
16 If not nil and not t, move to limit of search and return nil.
17 Optional fourth argument is repeat count--search for successive occurrences.
19 Search case-sensitivity is determined by the value of the variable
20 `case-fold-search', which see.
22 See also the functions `match-beginning', `match-end' and `replace-match'."
23 (gap-move-to (current-buffer) (buffer-point-aref (current-buffer)))
24 (let* ((buffer (current-buffer))
26 (n (loop for i from
0 below count
28 do
(setf pos
(search string
(buffer-data buffer
) :start2
(buffer-point-aref buffer
)))
32 (signal 'search-failed
))
33 (goto-char (+ (buffer-aref-to-char buffer pos
) (length string
))))))