From: Jon Eskin <eskinjp@gmail.com>
To: Manuel Uberti <manuel.uberti@inventati.org>
Cc: emacs-devel@gnu.org
Subject: Re: [Patch] Add project.el command to replace symbol at point throughout project
Date: Tue, 11 Jan 2022 04:50:13 -0500 [thread overview]
Message-ID: <CAAxk=2V-g=xZKykLRKy2Nm00RQQHOeO2jodBi95NxfBjt5Z1jw@mail.gmail.com> (raw)
In-Reply-To: <cc009d5c-5ddd-ca92-b2af-12ac3610704a@inventati.org>
[-- Attachment #1: Type: text/plain, Size: 2675 bytes --]
That's a great function, I love seeing all the results in an xref buffer. I
previously explored adding a command to the xref similar to
'xref-query-replace-in-results' that pre-populates the FROM field with the
item you were searching for when you executed 'project-find-regexp'.
Unfortunately I couldn't find a way to make that work- I couldn't find a
function or variable referring to the item being cross referenced in the
context of an xref buffer. If I understand correctly, xref only seems to be
concerned with logic to deal with xref results that it is provided. With
that assumption I couldn't really think of a way to architect a good
solution without modifying xref in a way that violates [what I understood
to be] its intent. I'm definitely open to suggestions on how to make that
work, though.
On Tue, Jan 11, 2022 at 2:51 AM Manuel Uberti <manuel.uberti@inventati.org>
wrote:
> On 11/01/22 08:45, Jon Eskin wrote:
> > Attached is a small patch adding command
> 'project-query-replace-at-point' to
> > project.el. The command is designed to improve the ergonomics of making
> a
> > project wide text replacement of a symbol at point.
> >
> > Currently, if you want to make a project wide replacement of a symbol
> using
> > project.el, the best options I've found are:
> >
> > - Mark the symbol you wish to replace
> > - Save symbol to kill ring with 'kill-ring-save'
> > - Enter command 'project-query-replace-regexp'
> > - Paste in the symbol, taking care to quote regex if necessary, and hit
> return
> > - Enter the replacement string and hit return
> >
> > or
> >
> > - Mark the symbol you wish to replace
> > - Save symbol to kill ring with 'kill-ring-save'
> > - Place cursor on symbol and enter command 'project-find-regexp'
> > - Hit return at the next prompt to accept the default prompt
> > - Enter command 'xref-query-replace-in-results'
> > - Enter the replacement string and hit return
> >
> > 'project-query-replace-at-point' regex-quotes the symbol at point and
> then calls
> > into the fileloop-initialize-replace function used by the existing
> > project-query-replace-regexp command.
> >
> > Replacing a symbol with 'project-query-replace-at-point' occurs as
> follows:
> >
> > - Place cursor on symbol and enter command
> 'project-query-replace-at-point'
> > - Enter the replacement string and hit return
> >
> > Let me know what you guys think. I haven't contributed before so please
> let me
> > know if I'm doing anything incorrectly.
> >
>
> I usually use the `project-find-regexp` approach you described, but I
> agree a
> simpler solution would be nicer.
>
> --
> Manuel Uberti
> www.manueluberti.eu
>
--
Jon Eskin
(301) 675-6663
[-- Attachment #2: Type: text/html, Size: 3508 bytes --]
next prev parent reply other threads:[~2022-01-11 9:50 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 [this message]
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
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='CAAxk=2V-g=xZKykLRKy2Nm00RQQHOeO2jodBi95NxfBjt5Z1jw@mail.gmail.com' \
--to=eskinjp@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=manuel.uberti@inventati.org \
/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.