[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f0ef1e9: Fix recent documentation additions
From: |
Eli Zaretskii |
Subject: |
master f0ef1e9: Fix recent documentation additions |
Date: |
Mon, 16 Aug 2021 13:12:21 -0400 (EDT) |
branch: master
commit f0ef1e971d200940f5ebf1d50707112df659da8e
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix recent documentation additions
* doc/lispref/searching.texi (Search and Replace): Document the
new functions by @defun.
---
doc/lispref/searching.texi | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index fe47e7c..4d5ae3c 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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master f0ef1e9: Fix recent documentation additions,
Eli Zaretskii <=