diff options
author | Eli Zaretskii <eliz@gnu.org> | 2021-08-16 20:11:33 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2021-08-16 20:11:33 +0300 |
commit | f0ef1e971d200940f5ebf1d50707112df659da8e (patch) | |
tree | ee97dbcb155be7c81e80a257feafe47e0232b63f /doc | |
parent | 958f5915672f77f2b98c425fae4035dea5dc5116 (diff) | |
download | emacs-f0ef1e971d200940f5ebf1d50707112df659da8e.tar.gz |
Fix recent documentation additions
* doc/lispref/searching.texi (Search and Replace): Document the
new functions by @defun.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lispref/searching.texi | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index fe47e7ccf57..4d5ae3cb437 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -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. |