unofficial mirror of bug-gnu-emacs@gnu.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 17:00:12 -0400	[thread overview]
Message-ID: <iersf8gnk0z.fsf@janestreet.com> (raw)
In-Reply-To: <83o7j42lq7.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 18 Aug 2023 22:29:04 +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 15:14:46 -0400
>> 
>> > 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.
>
> Then you are talking about something very different from "words".
>
>> > 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.
>
> That's profoundly not true!  Emacs is used with human-readable text
> not less, and maybe more, than with program source code.  I'm typing
> this email in Emacs; I'm routinely making changes to our documentation
> in Emacs -- these and others are all frequent text-editing activities.
>
>> So features which make query-replace work better with code are still
>> useful.
>
> No, we need a real refactoring in Emacs!  Using M-% as poor-man's
> refactoring is fine, but pretending that it _is_ refactoring, and
> adding minor extensions to it that are motivated by refactoring, is
> simply wrong!  It will likely complicate the text-oriented replacement
> we have already, and will always fall short of decent refactoring
> capabilities.
>
> We should work on adding refactoring instead of tweaking M-% and M-*
> in these directions.

Okay, I'm convinced.  I'll defer this functionality to the future
refactoring support in Emacs, built with project.el and eglot no doubt.

>> 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.
>
> IMO, this makes little or no sense in human-readable text; it does
> make sense in the refactoring context.  So let's add refactoring
> capabilities to Emacs, and leave M-% for text.





  reply	other threads:[~2023-08-18 21:00 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
2023-08-18 19:29                   ` Eli Zaretskii
2023-08-18 21:00                     ` Spencer Baugh [this message]
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=iersf8gnk0z.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 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).