emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Patch] Add project.el command to replace symbol at point throughout


From: Manuel Uberti
Subject: Re: [Patch] Add project.el command to replace symbol at point throughout project
Date: Tue, 11 Jan 2022 08:51:14 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]