Fix recent documentation additions
* doc/lispref/searching.texi (Search and Replace): Document the new functions by @defun.
This commit is contained in:
parent
958f591567
commit
f0ef1e971d
1 changed files with 20 additions and 10 deletions
|
@ -2553,21 +2553,31 @@ using @code{re-search-forward} and @code{replace-match}, like this:
|
|||
@xref{Replacing Match,, Replacing the Text that Matched}, for a
|
||||
description of @code{replace-match}.
|
||||
|
||||
@findex replace-regexp-in-region
|
||||
If it's more convenient, you can also use the
|
||||
@code{replace-regexp-in-region}, which does something similar to the
|
||||
loop above, but is optionally delimited to a specific region (and
|
||||
doesn't change point). Furthermore, it does the searches
|
||||
case-sensitively, and performs the replacements without changing case
|
||||
in the replacement.
|
||||
It may be more convenient to limit the replacements to a specific
|
||||
region. The function @code{replace-regexp-in-region} does that.
|
||||
|
||||
@defun replace-regexp-in-region regexp replacement &optional start end
|
||||
This function replaces all the occurrences of @var{regexp} with
|
||||
@var{replacement} in the region of buffer text between @var{start} and
|
||||
@var{end}; @var{start} defaults to position of point, and @var{end}
|
||||
defaults to the last accessible position of the buffer. The search
|
||||
for @var{regexp} is case-sensitive, and @var{replacement} is inserted
|
||||
without changing its letter-case. The @var{replacement} string can
|
||||
use the same special elements starting with @samp{\} as
|
||||
@code{replace-match} does. The function returns the number of
|
||||
replaced occurrences, or @code{nil} if @var{regexp} is not found. The
|
||||
function preserves the position of point.
|
||||
|
||||
@example
|
||||
(replace-regexp-in-region "foo[ \t]+bar" "foobar")
|
||||
@end example
|
||||
@end defun
|
||||
|
||||
@findex replace-string-in-region
|
||||
There's also @code{replace-string-in-region}, which works along the
|
||||
same lines, but searches for literal strings instead.
|
||||
@defun replace-string-in-region string replacement &optional start end
|
||||
This function works similarly to @code{replace-regexp-in-region},
|
||||
but searches for, and replaces, literal @var{string}s instead of
|
||||
regular expressions.
|
||||
@end defun
|
||||
|
||||
Emacs also has special functions for replacing matches in a string.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue