phi-search icon indicating copy to clipboard operation
phi-search copied to clipboard

Specify behavior for leaving the search mini-buffer without finishing the search

Open radrow opened this issue 2 years ago • 0 comments

Example repro:

  • Split window in 2
  • In window 1 start search (C-s test-phrase)
  • Scroll window 1 somewhere far away
  • In whatever way switch to window 2 (C-x o, <mouse-1>, etc)
  • Mezmerized by contents of window 2, hyperfocus your attention on it. Forget about the unfinished search in window 1
  • Try to search something in window 2

Expected behavior

  • Search in window 1 is either forgotten or suspended until back in that buffer, or moved to window 2
  • In window 2 a new search begins
  • Scroll position in window 1 is preserved

Current behavior

  • The contents of the search buffer contain the unfinished search string from window 1
  • If you press C-g or RET the focus jumps back to the window 1
  • Window 1 is scrolled back accordingly to the first search cancel/commit

Why I find it a problem

Essentially if I forget to properly close the search, the phi-search is transiently cursed preventing me from searching anything anywhere else. Moreover, emacs gives me very little feedback that there is some pending search going on. I also don't like that such a common and basic action like search in one buffer/window can do such notable changes to the layout of other buffers/windows.

How I would see a fix

It would be nice if that was configurable, for example through some search-exit hook. It would be also nice to be able to abort the search without changing the position of the cursor and view.

radrow avatar Aug 22 '23 08:08 radrow