ctrlf icon indicating copy to clipboard operation
ctrlf copied to clipboard

Lacks isearch-query-replace

Open yilkalargaw opened this issue 4 years ago • 5 comments

I love this package but whenever I want to move to query replace from within isearch I get the message query-replace-read-from: Command attempted to use minibuffer while in minibuffer. I can't figure if this is a bug or if the package lacks this functionality. If the functionality is absent it might be worth adding since it is one of the core functionalities of buffer local text search.

yilkalargaw avatar Dec 09 '21 20:12 yilkalargaw

Ah yes, there is no query-replace functionality in CTRLF. I wouldn't necessarily object to such a thing being added, although it would take a little bit of thought to do it in a way that's not a big mess (we don't want to simply invoke the existing query-replace logic, as that expects to operate within an Isearch context).

raxod502 avatar Dec 27 '21 20:12 raxod502

I just started using the package and also love the overall experience, but I do miss the ability to switch to query-replace easily.

The docs here say that M-% in isearch just "invokes query-replace or query-replace-regexp (depending on search mode) with the current search string used as the string to replace".

Admittedly, I haven't looked into the code for isearch and didn't notice any deeper interaction between isearch and query-replace from use, in this case. So I wonder if it would be easy to just integrate query-replace to use the current search string being used by ctrlf? Or is your concern more about inconsistent user experience?

kaofelix avatar Mar 02 '23 11:03 kaofelix

Mmm, I was thinking of a CTRLF-native search-and-replace. But you're right that a lower lift solution would be to just invoke query-replace with the current search string. No objection to that.

raxod502 avatar Mar 03 '23 00:03 raxod502

I gave a stab yesterday at writing a simple function for this, but couldn't get it to work... Granted, my Elisp knowledge is very sparse, I'm normally ad-hoc hacking a few things for my own usage.

I dug into the code for isearch-query-replace, and at a glance it doesn't look like they are straight just calling query-replace directly, but using some lower level APIs to realize the same work. When I have some free time I will see if I can understand the code better and try to replicate something similar for CTRLF. Happy to open a PR if I can come up with something.

BTW thanks for your hard work, love your packages!

kaofelix avatar Mar 03 '23 11:03 kaofelix

See also https://github.com/radian-software/ctrlf/issues/21

hab25 avatar Dec 14 '23 17:12 hab25