[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: |
Juri Linkov |
Subject: |
Re: [Patch] Add project.el command to replace symbol at point throughout project |
Date: |
Sun, 16 Jan 2022 19:58:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
>> This is needed to handle `read-regexp` in `occur-read-primary-args`
>> that uses the symbol `regexp-history-last` by default.
>
> occur?
>
> read-regexp is called from query-replace-read-from.
>
> Binding read-regexp-defaults-function doesn't seem to work because its use
> is for some reason predicated on (and defaults (symbolp defaults))
> evaluating to non-nil.
>
> And 'read-regexp' is called with nil second argument.
The customizable user option 'read-regexp-defaults-function' was created
for the following problem: by default, 'occur' uses the last history item
as the default value, so 'read-regexp-defaults-function' could be
customized to get a tag at point as the default value of 'occur'.
Exactly the same situation is with 'query-replace-read-from':
by default, it uses the last history item, so changing the value of
'read-regexp-defaults-function' should also affect the query-replace
like in the patch that I sent to Jon.
>> Before finishing this implementation, please answer one question.
>> `query-replace-read-from` uses two minibuffer-reading functions:
>> (if regexp-flag
>> (read-regexp prompt sym-at-point 'minibuffer-history)
>> (read-from-minibuffer
>> prompt nil nil nil nil
>> (query-replace-read-from-suggestions) t))
>> Do you think the same default with the symbol at point
>> should be used for the non-regexp case with read-from-minibuffer as well?
>> If yes, then we need a different solution that works for both cases.
>
> It doesn't have to be the same. project-query-replace-regexp could bind
> read-regexp-defaults-function, and xref-find-references-and-replace could
> bind something else. But that variable still needs to be created.
xref-find-references-and-replace calls query-replace-read-args
with a non-regexp flag, so I have no idea what new variable
could be created for read-from-minibuffer. It already uses
'query-replace-read-from-suggestions' where the top value
could be the default.
- Re: [Patch] Add project.el command to replace symbol at point throughout project, (continued)
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Eli Zaretskii, 2022/01/12
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Dmitry Gutov, 2022/01/12
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Eli Zaretskii, 2022/01/13
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Dmitry Gutov, 2022/01/13
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Eli Zaretskii, 2022/01/14
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Jon Eskin, 2022/01/14
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Dmitry Gutov, 2022/01/14
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Jon Eskin, 2022/01/15
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Juri Linkov, 2022/01/15
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Dmitry Gutov, 2022/01/15
- Re: [Patch] Add project.el command to replace symbol at point throughout project,
Juri Linkov <=
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Dmitry Gutov, 2022/01/16
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Dmitry Gutov, 2022/01/16
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Juri Linkov, 2022/01/17
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Dmitry Gutov, 2022/01/20
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Juri Linkov, 2022/01/31
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Dmitry Gutov, 2022/01/31
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Jon Eskin, 2022/01/15
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Juri Linkov, 2022/01/16
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Dmitry Gutov, 2022/01/16
- Re: [Patch] Add project.el command to replace symbol at point throughout project, Jon Eskin, 2022/01/17