aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLawrence Mitchell2012-08-05 21:30:15 +0800
committerChong Yidong2012-08-05 21:30:15 +0800
commitd32e47aff6cc01e3ccdfdf5e8f163f8a52285a75 (patch)
treed838446eefc3e60f0c45cd3d5821746de630b4bb
parent68b0c113f682c72daf36aa82b9f98008a5402362 (diff)
downloademacs-d32e47aff6cc01e3ccdfdf5e8f163f8a52285a75.tar.gz
emacs-d32e47aff6cc01e3ccdfdf5e8f163f8a52285a75.zip
* search.c (Freplace_match): Treat \? in the replacement text literally.
Fixes: debbugs:8161
-rw-r--r--etc/NEWS4
-rw-r--r--src/ChangeLog5
-rw-r--r--src/search.c5
3 files changed, 13 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index b7fb10881ff..e95ce5ac155 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -482,6 +482,10 @@ inefficiency, and not namespace-clean.
482 482
483* Incompatible Lisp Changes in Emacs 24.2 483* Incompatible Lisp Changes in Emacs 24.2
484 484
485** If the NEWTEXT arg to `replace-match' contains a substring "\?",
486that substring is inserted literally even if the LITERAL arg is
487non-nil, instead of causing an error to be signaled.
488
485+++ 489+++
486** Docstrings starting with `*' no longer indicate user options. 490** Docstrings starting with `*' no longer indicate user options.
487Only variables defined using `defcustom' are considered user options. 491Only variables defined using `defcustom' are considered user options.
diff --git a/src/ChangeLog b/src/ChangeLog
index 8d13944b633..d760dd1df78 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12012-08-05 Lawrence Mitchell <wence@gmx.li>
2
3 * search.c (Freplace_match): Treat \? in the replacement text
4 literally (Bug#8161).
5
12012-08-05 Chong Yidong <cyd@gnu.org> 62012-08-05 Chong Yidong <cyd@gnu.org>
2 7
3 * term.c (Vsuspend_tty_functions, Vresume_tty_functions): 8 * term.c (Vsuspend_tty_functions, Vresume_tty_functions):
diff --git a/src/search.c b/src/search.c
index 480d0b75c70..004e599be9c 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2226,6 +2226,9 @@ Otherwise treat `\\' as special:
2226 `\\N' means substitute what matched the Nth `\\(...\\)'. 2226 `\\N' means substitute what matched the Nth `\\(...\\)'.
2227 If Nth parens didn't match, substitute nothing. 2227 If Nth parens didn't match, substitute nothing.
2228 `\\\\' means insert one `\\'. 2228 `\\\\' means insert one `\\'.
2229 `\\?' is treated literally
2230 (for compatibility with `query-replace-regexp').
2231 Any other character following `\\' signals an error.
2229Case conversion does not apply to these substitutions. 2232Case conversion does not apply to these substitutions.
2230 2233
2231FIXEDCASE and LITERAL are optional arguments. 2234FIXEDCASE and LITERAL are optional arguments.
@@ -2428,7 +2431,7 @@ since only regular expressions have distinguished subexpressions. */)
2428 } 2431 }
2429 else if (c == '\\') 2432 else if (c == '\\')
2430 delbackslash = 1; 2433 delbackslash = 1;
2431 else 2434 else if (c != '?')
2432 error ("Invalid use of `\\' in replacement text"); 2435 error ("Invalid use of `\\' in replacement text");
2433 } 2436 }
2434 if (substart >= 0) 2437 if (substart >= 0)