[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65347: 29.1; Underscore in query replace prevents case-matching
From: |
Spencer Baugh |
Subject: |
bug#65347: 29.1; Underscore in query replace prevents case-matching |
Date: |
Fri, 18 Aug 2023 12:30:48 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Stefan Monnier <monnier@iro.umontreal.ca>
>> Cc: Eli Zaretskii <eliz@gnu.org>, 65347@debbugs.gnu.org
>> Date: Thu, 17 Aug 2023 22:04:53 -0400
>>
>> > Although, a further relevant question: is there some way to make _ not
>> > be a word separator, in this specific context? Without changing the
>> > syntax table of the buffer overall? So that foo_bar is interpreted as
>> > one word?
>>
>> There's `superword-mode`, but I suspect that query-replace does not
>> honor it in this case. Could be considered as a bug in
>> `superword-mode`.
>
> Actually, I think it's a bug in replace-match: it doesn't honor
> find-word-boundary-function-table. I think it should. Patches
> welcome.
I suppose this is a bit of an XY problem - the real thing I (speaking
for the user who reported this to me) want is to have case-matching for
symbols instead of words.
e.g. if I have Foo-do-action and I do a replace of foo-do-action with
bar-do-action, I want the replacement to be Bar-do-action.
That seems like a reasonable customization... I could add support for
this to replace-match - it would just be a matter of teaching it to
conditionally use symbol boundaries instead of word boundaries.
Alternatively, much more interestingly, the case-matching could *always*
detect case patterns both for symbols and for words. And if there's no
case pattern for words, but there is a case pattern for symbols, apply
that case pattern to symbols in the replacement. We could even turn
that on by default. Does that sound like a good change? I can make
that change if it sounds desirable.
Alternatively, much more simply, maybe the case-matching could just
detect if the first word is capitalized, and then also capitalize the
first word in the replacement? That would work for this specific usage.
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Spencer Baugh, 2023/08/16
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Eli Zaretskii, 2023/08/17
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Spencer Baugh, 2023/08/17
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Eli Zaretskii, 2023/08/17
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Stefan Monnier, 2023/08/17
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Eli Zaretskii, 2023/08/18
- bug#65347: 29.1; Underscore in query replace prevents case-matching,
Spencer Baugh <=
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Eli Zaretskii, 2023/08/18
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Spencer Baugh, 2023/08/18
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Eli Zaretskii, 2023/08/18
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Spencer Baugh, 2023/08/18
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Eli Zaretskii, 2023/08/18
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Spencer Baugh, 2023/08/18
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Eli Zaretskii, 2023/08/19
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Richard Stallman, 2023/08/20
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Stefan Monnier, 2023/08/18
- bug#65347: 29.1; Underscore in query replace prevents case-matching, Eli Zaretskii, 2023/08/19