Before using any of these functions to do a character search, look at character attributes (page character-attributes). They provide a facility similar to the syntax table in real EMACS. Syntax tables are a powerful, general, and efficient mechanism for assigning meanings to characters in various modes.
An exclusive upper limit for the char-code of characters given to the searching functions. The result of searches for characters with a char-code greater than or equal to this limit is ill-defined, but it is not an error to do such searches.
&optional
result-search-pattern ¶Returns a search-pattern object which can be given to the find-pattern
and replace-pattern
functions. A search-pattern is a specification of a
particular sort of search to do. direction is either :forward
or
:backward
, indicating the direction to search in. kind specifies the
kind of search pattern to make, and pattern is a thing which specifies what
to search for.
The interpretation of pattern depends on the kind of pattern being made. Currently defined kinds of search pattern are:
:string-insensitive
Does a case-insensitive string search, pattern being the string to search for.
:string-sensitive
Does a case-sensitive string search for pattern.
:character
Finds an occurrence of the character pattern. This is case sensitive.
:not-character
Find a character which is not the character pattern.
:test
Finds a character which satisfies the function pattern. This function may not be applied an any particular fashion, so it should depend only on what its argument is, and should have no side-effects.
:test-not
Similar to as :test
, except it finds a character that
fails the test.
:any
Finds a character that is in the string pattern.
:not-any
Finds a character that is not in the string pattern.
result-search-pattern, if supplied, is a search-pattern to destructively modify to produce the new pattern. Where reasonable this should be supplied, since some kinds of search patterns may involve large data structures.
Returns t
if search-pattern is a search-pattern
object, otherwise
nil.
get-search-pattern
interfaces to a default search string and pattern that
search and replacing commands can use. These commands then share a default
when prompting for what to search or replace, and save on consing a search
pattern each time they execute. This uses Default Search Kind (see the
Hemlock User’s Manual) when updating the pattern object. This returns the
pattern, so you probably don’t need to refer to last-search-pattern, but
last-search-string is useful when prompting.
Find the next match of search-pattern starting at mark. If a match is found then mark is altered to point before the matched text and the number of characters matched is returned. If no match is found then nil is returned and mark is not modified.
&optional
n ¶Replace n matches of search-pattern with the string replacement starting at mark. If n is nil (the default) then replace all matches. A mark pointing before the last replacement done is returned.