aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-11-07 23:46:35 +0800
committerChong Yidong2012-11-07 23:46:35 +0800
commit8a3afaf9ea1812d8c341ea27744d68441f3ce5a5 (patch)
tree244e51a1425d349396fedf44a74e0bb6da6ab714
parentfdaf534a7b1f94563065f0136cb7bac981722877 (diff)
downloademacs-8a3afaf9ea1812d8c341ea27744d68441f3ce5a5.tar.gz
emacs-8a3afaf9ea1812d8c341ea27744d68441f3ce5a5.zip
* doc/lispref/searching.texi (Replacing Match): Document \? in replace-match.
-rw-r--r--doc/lispref/ChangeLog2
-rw-r--r--doc/lispref/searching.texi27
-rw-r--r--etc/NEWS1
3 files changed, 21 insertions, 9 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 1339e727bd8..eba44b5743d 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -7,6 +7,8 @@
7 7
82012-11-07 Chong Yidong <cyd@gnu.org> 82012-11-07 Chong Yidong <cyd@gnu.org>
9 9
10 * searching.texi (Replacing Match): Document \? in replace-match.
11
10 * variables.texi (Creating Buffer-Local): Document setq-local and 12 * variables.texi (Creating Buffer-Local): Document setq-local and
11 defvar-local. 13 defvar-local.
12 (Setting Generalized Variables): Arrange table alphabetically. 14 (Setting Generalized Variables): Arrange table alphabetically.
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 56c96363e81..f165381a0f8 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1310,22 +1310,31 @@ part of one of the following sequences:
1310@table @asis 1310@table @asis
1311@item @samp{\&} 1311@item @samp{\&}
1312@cindex @samp{&} in replacement 1312@cindex @samp{&} in replacement
1313@samp{\&} stands for the entire text being replaced. 1313This stands for the entire text being replaced.
1314 1314
1315@item @samp{\@var{n}} 1315@item @samp{\@var{n}}, where @var{n} is a digit
1316@cindex @samp{\@var{n}} in replacement 1316@cindex @samp{\@var{n}} in replacement
1317@samp{\@var{n}}, where @var{n} is a digit, stands for the text that 1317This stands for the text that matched the @var{n}th subexpression in
1318matched the @var{n}th subexpression in the original regexp. 1318the original regexp. Subexpressions are those expressions grouped
1319Subexpressions are those expressions grouped inside @samp{\(@dots{}\)}. 1319inside @samp{\(@dots{}\)}. If the @var{n}th subexpression never
1320If the @var{n}th subexpression never matched, an empty string is substituted. 1320matched, an empty string is substituted.
1321 1321
1322@item @samp{\\} 1322@item @samp{\\}
1323@cindex @samp{\} in replacement 1323@cindex @samp{\} in replacement
1324@samp{\\} stands for a single @samp{\} in the replacement text. 1324This stands for a single @samp{\} in the replacement text.
1325
1326@item @samp{\?}
1327This stands for itself (for compatibility with @code{replace-regexp}
1328and related commands; @pxref{Regexp Replacement,,, emacs, The GNU
1329Emacs Manual}).
1325@end table 1330@end table
1326 1331
1327These substitutions occur after case conversion, if any, 1332@noindent
1328so the strings they substitute are never case-converted. 1333Any other character following @samp{\} signals an error.
1334
1335The substitutions performed by @samp{\&} and @samp{\@var{n}} occur
1336after case conversion, if any. Therefore, the strings they substitute
1337are never case-converted.
1329 1338
1330If @var{subexp} is non-@code{nil}, that says to replace just 1339If @var{subexp} is non-@code{nil}, that says to replace just
1331subexpression number @var{subexp} of the regexp that was matched, not 1340subexpression number @var{subexp} of the regexp that was matched, not
diff --git a/etc/NEWS b/etc/NEWS
index 79fc95b4848..ed69ae3fa6f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -699,6 +699,7 @@ sequence in later calls.
699font name as a string. Whether it returns a font spec or a font name 699font name as a string. Whether it returns a font spec or a font name
700depends on the graphical library. 700depends on the graphical library.
701 701
702+++
702** If the NEWTEXT arg to `replace-match' contains a substring "\?", 703** If the NEWTEXT arg to `replace-match' contains a substring "\?",
703that substring is inserted literally even if the LITERAL arg is 704that substring is inserted literally even if the LITERAL arg is
704non-nil, instead of causing an error to be signaled. 705non-nil, instead of causing an error to be signaled.