]> git.eshelyaron.com Git - emacs.git/commitdiff
* search.c (Freplace_match): Treat \? in the replacement text literally.
authorLawrence Mitchell <wence@gmx.li>
Sun, 5 Aug 2012 13:30:15 +0000 (21:30 +0800)
committerChong Yidong <cyd@gnu.org>
Sun, 5 Aug 2012 13:30:15 +0000 (21:30 +0800)
Fixes: debbugs:8161
etc/NEWS
src/ChangeLog
src/search.c

index b7fb10881ffd9222384429d37cbbe2c82443f4a0..e95ce5ac1555c31cbd08a132110ad8385bcc6540 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -482,6 +482,10 @@ inefficiency, and not namespace-clean.
 \f
 * Incompatible Lisp Changes in Emacs 24.2
 
+** 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.
+
 +++
 ** Docstrings starting with `*' no longer indicate user options.
 Only variables defined using `defcustom' are considered user options.
index 8d13944b633070b739e5b8005f6ce9a6aa4cfda2..d760dd1df78b3f9706a8e76c14e4f5f36f1d170a 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-05  Lawrence Mitchell  <wence@gmx.li>
+
+       * search.c (Freplace_match): Treat \? in the replacement text
+       literally (Bug#8161).
+
 2012-08-05  Chong Yidong  <cyd@gnu.org>
 
        * term.c (Vsuspend_tty_functions, Vresume_tty_functions):
index 480d0b75c708f935c166b9d40e8d84bcac8c0270..004e599be9c314596fc3d1833cc343e735c96e26 100644 (file)
@@ -2226,6 +2226,9 @@ Otherwise treat `\\' as special:
   `\\N' means substitute what matched the Nth `\\(...\\)'.
        If Nth parens didn't match, substitute nothing.
   `\\\\' means insert one `\\'.
+  `\\?' is treated literally
+       (for compatibility with `query-replace-regexp').
+  Any other character following `\\' signals an error.
 Case conversion does not apply to these substitutions.
 
 FIXEDCASE and LITERAL are optional arguments.
@@ -2428,7 +2431,7 @@ since only regular expressions have distinguished subexpressions.  */)
                    }
                  else if (c == '\\')
                    delbackslash = 1;
-                 else
+                 else if (c != '?')
                    error ("Invalid use of `\\' in replacement text");
                }
              if (substart >= 0)