summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLawrence Mitchell <wence@gmx.li>2012-08-05 21:30:15 +0800
committerChong Yidong <cyd@gnu.org>2012-08-05 21:30:15 +0800
commitd32e47aff6cc01e3ccdfdf5e8f163f8a52285a75 (patch)
treed838446eefc3e60f0c45cd3d5821746de630b4bb /src
parent68b0c113f682c72daf36aa82b9f98008a5402362 (diff)
downloademacs-d32e47aff6cc01e3ccdfdf5e8f163f8a52285a75.tar.gz
emacs-d32e47aff6cc01e3ccdfdf5e8f163f8a52285a75.tar.bz2
emacs-d32e47aff6cc01e3ccdfdf5e8f163f8a52285a75.zip
* search.c (Freplace_match): Treat \? in the replacement text literally.
Fixes: debbugs:8161
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/search.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8d13944b633..d760dd1df78 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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):
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:
`\\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)