emacs-devel
[Top][All Lists]
Advanced

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

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


From: Jon Eskin
Subject: [Patch] Add project.el command to replace symbol at point throughout project
Date: Tue, 11 Jan 2022 02:45:57 -0500

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.

Attachment: 0001-Add-function-for-project-wide-replacement-of-symbol-.patch
Description: Text Data


reply via email to

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