From: Juri Linkov <juri@linkov.net>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Jon Eskin <eskinjp@gmail.com>, emacs-devel@gnu.org
Subject: Re: [Patch] Add project.el command to replace symbol at point throughout project
Date: Wed, 12 Jan 2022 21:56:09 +0200 [thread overview]
Message-ID: <868rvkpw2u.fsf@mail.linkov.net> (raw)
In-Reply-To: <699f09df-d685-ce80-7c57-a36824e7066b@yandex.ru> (Dmitry Gutov's message of "Wed, 12 Jan 2022 21:43:43 +0200")
>>> If we're trying to improve project-query-replace-regexp, why not make it
>>> use the symbol at point by default?
>>>
>> I thought about the option of using symbol at point by default, but
>> I noticed that the command currently uses the history
>> variable. I wondered if some people were relying on its current behavior
>> in a way that I didn’t anticipate (especially since I’m pretty new to all
>> this). If so, it would be an annoying change to have to worry about
>> whether the cursor is on a symbol when using a command you previously
>> relied on. I wanted to try to put forth something possibly useful without
>> breaking stuff.
>>
>>> You would use the same command, but would be able to press RET to have
>>> the default regexp (symbol at point) used as FROM. I don't have a patch
>>> yet, but it might be something that all callers of
>>> query-replace-read-args might benefit from.
>> Since I think I can understand what you’re suggesting, I would be happy
>> to make an attempt at a patch to modify the callers of
>> query-replace-read-args to default to a regexp quoted
>> symbol-at-point. But no worries if you would rather have experienced eyes
>> on it.
>
> I'm actually not sure about the best way to implement this: whether we
> definitely want query-replace-read-args to use symbol-at-point as the
> default FROM. But it does sounds handy to me. Let's ask the developer who
> touched it last.
query-replace-read-args can't be changed because in query-replace
RET should use the previous from->to pair from the history.
So if you want, you could change project-query-replace-regexp:
let-bind read-regexp-defaults-function around the call
of query-replace-read-args, and use a symbol at point as the default.
>>> And you can actually do this right now:
>>>
>>> - Enter command 'project-query-replace-regexp'
>>> - Press M-n, having the symbol at point picked up as FROM, hit return
>>> - Enter the replacement string and hit return
>> This is awesome! Did not know about that behavior, thank you for sharing!
>
> That capability actually comes with the "forward history" thing. Not very
> obvious, but when you learn about it, it's pretty nice.
Maybe the prompt should show some indication that the default
can be fetched by M-n?
next prev parent reply other threads:[~2022-01-12 19:56 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-11 7:45 [Patch] Add project.el command to replace symbol at point throughout project Jon Eskin
2022-01-11 7:51 ` Manuel Uberti
2022-01-11 9:50 ` Jon Eskin
2022-01-12 3:43 ` Dmitry Gutov
2022-01-12 9:42 ` Jon Eskin
2022-01-13 1:03 ` Dmitry Gutov
2022-01-13 9:57 ` Jon Eskin
2022-01-14 2:39 ` Dmitry Gutov
2022-01-11 13:10 ` Eli Zaretskii
2022-01-11 15:15 ` Daniel Martín
2022-01-11 17:17 ` Eli Zaretskii
2022-01-12 3:46 ` Dmitry Gutov
2022-01-12 12:45 ` Eli Zaretskii
2022-01-13 1:19 ` Dmitry Gutov
2022-01-13 8:25 ` Eli Zaretskii
2022-01-14 2:43 ` Dmitry Gutov
2022-01-14 7:46 ` Eli Zaretskii
2022-01-14 10:26 ` Jon Eskin
2022-01-14 20:28 ` Dmitry Gutov
2022-01-15 9:55 ` Jon Eskin
2022-01-15 18:30 ` Juri Linkov
2022-01-16 3:02 ` Dmitry Gutov
2022-01-16 17:58 ` Juri Linkov
2022-01-17 0:19 ` Dmitry Gutov
2022-01-17 1:15 ` Dmitry Gutov
2022-01-17 8:17 ` Juri Linkov
2022-01-21 3:06 ` Dmitry Gutov
2022-01-31 18:25 ` Juri Linkov
2022-02-01 2:10 ` Dmitry Gutov
2022-02-01 20:09 ` Juri Linkov
2022-02-01 22:07 ` Dmitry Gutov
2022-02-02 19:51 ` Juri Linkov
2022-02-02 21:09 ` Dmitry Gutov
2022-01-15 18:41 ` Jon Eskin
2022-01-16 17:55 ` Juri Linkov
2022-01-17 1:41 ` Dmitry Gutov
2022-01-17 6:36 ` Jon Eskin
2022-01-12 3:42 ` Dmitry Gutov
2022-01-12 8:03 ` Jon Eskin
2022-01-12 19:43 ` Dmitry Gutov
2022-01-12 19:56 ` Juri Linkov [this message]
2022-01-12 22:12 ` Dmitry Gutov
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=868rvkpw2u.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=eskinjp@gmail.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 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.