1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-31 17:30:54 -08:00

(Freplace_match): Improve capitalization heuristics.

This commit is contained in:
Karl Heuer 1994-05-25 03:59:06 +00:00
parent 026e833080
commit 73dc877110

View file

@ -1174,6 +1174,7 @@ Leaves point at end of replacement text.")
register int pos, last;
int some_multiletter_word;
int some_lowercase;
int some_uppercase;
int some_lowercase_initial;
register int c, prevc;
int inslen;
@ -1205,6 +1206,7 @@ Leaves point at end of replacement text.")
some_multiletter_word = 0;
some_lowercase = 0;
some_lowercase_initial = 0;
some_uppercase = 0;
for (pos = search_regs.start[0]; pos < last; pos++)
{
@ -1221,6 +1223,7 @@ Leaves point at end of replacement text.")
}
else if (!NOCASEP (c))
{
some_uppercase = 1;
if (SYNTAX (prevc) != Sword)
;
else
@ -1235,11 +1238,12 @@ Leaves point at end of replacement text.")
if (! some_lowercase && some_multiletter_word)
case_action = all_caps;
/* Capitalize each word, if the old text has all capitalized words. */
/* We used to insist on some_multiletter_word here,
but that screwed query replacing x with y, acting on X.
Even what we have now is more strict than what 19.22 had. */
else if (!some_lowercase_initial)
else if (!some_lowercase_initial && some_multiletter_word)
case_action = cap_initial;
else if (!some_lowercase_initial && some_uppercase)
/* Should x -> yz, operating on X, give Yz or YZ?
We'll assume the latter. */
case_action = all_caps;
else
case_action = nochange;
}