zk-phi / phi-search

Another incremental search command, compatible with “multiple-cursors”
127 stars 12 forks source link

Recursive searches break the modeline #40

Open wavexx opened 9 years ago

wavexx commented 9 years ago

Assuming C-s is bound to phi-search:

C-s ; start phi-search C-x o ; switch away C-s ; break the modeline

I noticed that I got the modeline stuck with phi-search, and today I finally was able to realize how I did it ;). Isearch has quite a complex logic to determine when aborting search since it supports recursive searches, but the most interesting seem:

(add-hook 'mouse-leave-buffer-hook 'isearch-done) (add-hook 'kbd-macro-termination-hook 'isearch-done)

I'm not sure if 'mouse-leave-buffer-hook is also run for C-x o?

wavexx commented 9 years ago

After looking at this a bit, I've found that isearch handles this in the 'pre-command-hook.

zk-phi commented 9 years ago

Thanks for reporting!

wavexx commented 9 years ago

If phi-seach is active, instead of erroring, what about just switching to the minibuffer? This allows to continue the previous search.

wavexx commented 9 years ago

On 04/08/2015 02:23 PM, zk-phi wrote:

we probably need to abort recursive edit instead of switching to the minibuffer recursively, but I wonder if just calling (abort-recursive-edit) is fine.

I was thinking more of:

(when phi-search--active (select-window (active-minibuffer-window)) (return-from ...)

so that it just switches to the minibuffer and the old search continues.

zk-phi commented 9 years ago

yes, I've just committed so please update phi-search.

wavexx commented 9 years ago

On 04/08/2015 02:45 PM, zk-phi wrote:

yes, I've just committed so please update phi-search.

Sorry I replied by mail and didn't see it.

wavexx commented 9 years ago

Another way to break the modeline is to execute another read-from-minibuffer call :/ C-s, C-x o, M-x (for example).

I think read-from-minibuffer does a non-local exit in this case, which should be trapped with unwind-protect or condition-case.