aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-05-04 06:33:47 +0000
committerRichard M. Stallman2002-05-04 06:33:47 +0000
commit2037b26301a67531ebed5f5bb56e7dbf95aaeb51 (patch)
treef1a8ec8f9f3346976bfd7c4dcbde291daa1bb8df
parent8f21d64ed153342c04bf22fc37bc8056d2c563eb (diff)
downloademacs-2037b26301a67531ebed5f5bb56e7dbf95aaeb51.tar.gz
emacs-2037b26301a67531ebed5f5bb56e7dbf95aaeb51.zip
Clarify how replace-match does case conversion.
-rw-r--r--lispref/searching.texi21
1 files changed, 12 insertions, 9 deletions
diff --git a/lispref/searching.texi b/lispref/searching.texi
index 1e140aa641a..6918aa32f1a 100644
--- a/lispref/searching.texi
+++ b/lispref/searching.texi
@@ -1209,15 +1209,15 @@ If you did the search in a string, pass the same string as @var{string}.
1209Then @code{replace-match} does the replacement by constructing and 1209Then @code{replace-match} does the replacement by constructing and
1210returning a new string. 1210returning a new string.
1211 1211
1212If @var{fixedcase} is non-@code{nil}, then the case of the replacement 1212If @var{fixedcase} is non-@code{nil}, then @code{replace-match} uses
1213text is not changed; otherwise, the replacement text is converted to a 1213the replacement text without case conversion; otherwise, it converts
1214different case depending upon the capitalization of the text to be 1214the replacement text depending upon the capitalization of the text to
1215replaced. If the original text is all upper case, the replacement text 1215be replaced. If the original text is all upper case, this converts
1216is converted to upper case. If the first word of the original text is 1216the replacement text to upper case. If all words of the original text
1217capitalized, then the first word of the replacement text is capitalized. 1217are capitalized, this capitalizes all the words of the replacement
1218If the original text contains just one word, and that word is a capital 1218text. If all the words are one-letter and they are all upper case,
1219letter, @code{replace-match} considers this a capitalized first word 1219they are treated as capitalized words rather than all-upper-case
1220rather than all upper case. 1220words.
1221 1221
1222If @var{literal} is non-@code{nil}, then @var{replacement} is inserted 1222If @var{literal} is non-@code{nil}, then @var{replacement} is inserted
1223exactly as it is, the only alterations being case changes as needed. 1223exactly as it is, the only alterations being case changes as needed.
@@ -1241,6 +1241,9 @@ Subexpressions are those expressions grouped inside @samp{\(@dots{}\)}.
1241@samp{\\} stands for a single @samp{\} in the replacement text. 1241@samp{\\} stands for a single @samp{\} in the replacement text.
1242@end table 1242@end table
1243 1243
1244These substitutions occur after case conversion, if any,
1245so the strings they substitute are never case-converted.
1246
1244If @var{subexp} is non-@code{nil}, that says to replace just 1247If @var{subexp} is non-@code{nil}, that says to replace just
1245subexpression number @var{subexp} of the regexp that was matched, not 1248subexpression number @var{subexp} of the regexp that was matched, not
1246the entire match. For example, after matching @samp{foo \(ba*r\)}, 1249the entire match. For example, after matching @samp{foo \(ba*r\)},