From 8a3afaf9ea1812d8c341ea27744d68441f3ce5a5 Mon Sep 17 00:00:00 2001
From: Chong Yidong <cyd@gnu.org>
Date: Wed, 7 Nov 2012 23:46:35 +0800
Subject: [PATCH] * doc/lispref/searching.texi (Replacing Match): Document \?
 in replace-match.

---
 doc/lispref/ChangeLog      |  2 ++
 doc/lispref/searching.texi | 27 ++++++++++++++++++---------
 etc/NEWS                   |  1 +
 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 @@
 
 2012-11-07  Chong Yidong  <cyd@gnu.org>
 
+	* searching.texi (Replacing Match): Document \? in replace-match.
+
 	* variables.texi (Creating Buffer-Local): Document setq-local and
 	defvar-local.
 	(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:
 @table @asis
 @item @samp{\&}
 @cindex @samp{&} in replacement
-@samp{\&} stands for the entire text being replaced.
+This stands for the entire text being replaced.
 
-@item @samp{\@var{n}}
+@item @samp{\@var{n}}, where @var{n} is a digit
 @cindex @samp{\@var{n}} in replacement
-@samp{\@var{n}}, where @var{n} is a digit, stands for the text that
-matched the @var{n}th subexpression in the original regexp.
-Subexpressions are those expressions grouped inside @samp{\(@dots{}\)}.
-If the @var{n}th subexpression never matched, an empty string is substituted.
+This stands for the text that matched the @var{n}th subexpression in
+the original regexp.  Subexpressions are those expressions grouped
+inside @samp{\(@dots{}\)}.  If the @var{n}th subexpression never
+matched, an empty string is substituted.
 
 @item @samp{\\}
 @cindex @samp{\} in replacement
-@samp{\\} stands for a single @samp{\} in the replacement text.
+This stands for a single @samp{\} in the replacement text.
+
+@item @samp{\?}
+This stands for itself (for compatibility with @code{replace-regexp}
+and related commands; @pxref{Regexp Replacement,,, emacs, The GNU
+Emacs Manual}).
 @end table
 
-These substitutions occur after case conversion, if any,
-so the strings they substitute are never case-converted.
+@noindent
+Any other character following @samp{\} signals an error.
+
+The substitutions performed by @samp{\&} and @samp{\@var{n}} occur
+after case conversion, if any.  Therefore, the strings they substitute
+are never case-converted.
 
 If @var{subexp} is non-@code{nil}, that says to replace just
 subexpression 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.
 font name as a string.  Whether it returns a font spec or a font name
 depends on the graphical library.
 
++++
 ** If the NEWTEXT arg to `replace-match' contains a substring "\?",
 that substring is inserted literally even if the LITERAL arg is
 non-nil, instead of causing an error to be signaled.
-- 
2.39.5