From: Eli Zaretskii <eliz@gnu.org>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca
Subject: bug#65347: 29.1; Underscore in query replace prevents case-matching
Date: Fri, 18 Aug 2023 21:15:21 +0300 [thread overview]
Message-ID: <83wmxs2p52.fsf@gnu.org> (raw)
In-Reply-To: <ier4jkwpb2f.fsf@janestreet.com> (message from Spencer Baugh on Fri, 18 Aug 2023 12:30:48 -0400)
> From: Spencer Baugh <sbaugh@janestreet.com>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 65347@debbugs.gnu.org
> Date: Fri, 18 Aug 2023 12:30:48 -0400
>
> Eli Zaretskii <eliz@gnu.org> writes:
> >> 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.
We look at this from different angles. As an Emacs maintainer, I
would like to see every place that deals with words to honor
find-word-boundary-function-table, instead of inventing its own ideas
about where a word begins and where it ends.
> 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.
Here, you look at the issue from a very narrow perspective: of words
separated by '-' or '_', because that just happens to be the case that
you bumped into. But that is just one very particular use case; words
can be separated by a lot more characters. I would actually begin
considering the simpler case of "Foo do action".
> 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.
Given enough user options, we could support that as optional behavior.
But one thing is clear: we cannot simultaneously support all of the
possible interpretations of "capitalization pattern". And another
thing is clear: this heuristic is confusing and rarely kept in mind as
it is, so imagine what will happen if we add half a dozen options to
support its variants...
next prev parent reply other threads:[~2023-08-18 18:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 21:27 bug#65347: 29.1; Underscore in query replace prevents case-matching Spencer Baugh
2023-08-17 7:14 ` Eli Zaretskii
2023-08-17 12:42 ` Spencer Baugh
2023-08-17 13:26 ` Eli Zaretskii
2023-08-18 2:04 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-18 6:04 ` Eli Zaretskii
2023-08-18 16:30 ` Spencer Baugh
2023-08-18 18:15 ` Eli Zaretskii [this message]
2023-08-18 18:31 ` Spencer Baugh
2023-08-18 19:06 ` Eli Zaretskii
2023-08-18 19:14 ` Spencer Baugh
2023-08-18 19:29 ` Eli Zaretskii
2023-08-18 21:00 ` Spencer Baugh
2023-08-19 6:00 ` Eli Zaretskii
2023-08-21 1:13 ` Richard Stallman
2023-08-18 19:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-19 5:50 ` Eli Zaretskii
2023-08-19 14:39 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-19 14:50 ` Eli Zaretskii
2023-08-19 15:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-19 19:14 ` Eli Zaretskii
2023-08-20 0:03 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-19 14:52 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-19 15:01 ` Eli Zaretskii
2023-08-19 16:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83wmxs2p52.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=65347@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=sbaugh@janestreet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).