all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: Eli Zaretskii <eliz@gnu.org>
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 15:14:46 -0400	[thread overview]
Message-ID: <iery1i8nowp.fsf@janestreet.com> (raw)
In-Reply-To: <83sf8g2mrr.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 18 Aug 2023 22:06:32 +0300")

Eli Zaretskii <eliz@gnu.org> writes:
>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Cc: 65347@debbugs.gnu.org,  monnier@iro.umontreal.ca
>> Date: Fri, 18 Aug 2023 14:31:46 -0400
>> 
>> > 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".
>> 
>> But no, this use case very specifically is about replacing symbols
>> (sexps) while matching case.
>
> What are "symbols" in this context?

Strings made up of symbol constituents as defined by the current
major-mode's syntax table.  The normal definition of symbols.

>> I don't much care about the word boundary or superword-mode, because I'm
>> not dealing with words - I'm very deliberately dealing with symbols.
>
> Capitalization issues with program code are conceptually different
> from those with human-readable text.  You are basically talking about
> refactoring, not about text replacement.  So the use cases that are of
> interest to you are not well supported by query-replace, because it
> doesn't target them.  It could well mean that you will need a custom
> replace-match function.  Insisting on replace-match to support these
> cases is not necessarily wise, from where I stand.

Hm, that's fair.  Although I would bet that the majority of usage of
query-replace is with program code, since the majority of Emacs usage is
with program code.  So features which make query-replace work better
with code are still useful.

Another feature that could support this would be to allow defining
multiple query/replacement pairs, and applying them together across the
file or across multiple files, querying as we go.  Then "foo" could be
replaced with "bar" and "Foo" with "Bar".  That kind of simultaneous
replacement is something I've definitely wanted before.

>> What about the other thing I proposed?  That's what I'm more interested
>> in, because this is a problem of replacing symbols.  And it's much more
>> elegant.  Repeated here:
>> 
>> >>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.
>
> I don't understand the proposal.  Again, what are "symbols" in this
> context, and how are they different from "words"?

The normal definition of symbols in Emacs, as defined by the syntax
table.





  reply	other threads:[~2023-08-18 19:14 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
2023-08-18 18:31             ` Spencer Baugh
2023-08-18 19:06               ` Eli Zaretskii
2023-08-18 19:14                 ` Spencer Baugh [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iery1i8nowp.fsf@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=65347@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.