radian-software/ctrlf

Issues when invoking ctrlf multiple times in different windows

jdtsmith opened this issue · 3 comments

In a browser, you can easily start separate searches that are tied to that window, leave that search active, switch to another tab or window, and start or resume a search there. CTRLF obviously can't do this, but also doesn't report anything if you try (Ctrl-s remain silent fails if a search is running in another window elsewhere). ctrlf-forward-symbol-at-point on another window/frame during a ctrlf search does do something: it deletes everything else in the buffer except the symbol at point!

What should ctrlf do? Perhaps follow isearch, and silently abandon the pre-existing search and just start a new one in the current buffer.

Ah, yes, I see what you mean. Unfortunately, Emacs doesn't really have an interface that could be used for multiple concurrent searches like this. You can have multiple active minibuffers (see enable-recursive-minibuffers), but they have a strict ordering: it's like a stack. You can't, to my knowledge, switch which minibuffer in the stack is active/visible.

In light of that, your suggestion to automatically abort the existing search when a new one is started seems like a good one. That should be doable by updating the logic in ctrlf-forward and ctrlf-backward, although since aborting a search means exiting a recursive edit, we may have to abuse an idle timer to start the new search after aborting the current one.

Either way, the current behavior is clearly buggy, in the ways that you point out. (And I discovered another failure condition, which is that it's possible to get the search result highlighting to stick around in a buffer even after the search is exited.)

sa1 commented

Any updates on this? I hit these failure conditions often.

No, unfortunately, I don't have enough time to actively implement new features and bugfixes at the moment in CTRLF. But I do promise to review and merge a pull request to the effect.