4

I use C-s to search for a string. All matches are highlighted. Then I would like to scroll down by C-v, but all matches disappear.

I know keeping C-s will move to the next match, but it is too slow. How shall I do then? Thanks.

3
  • If you scroll down with C-v, and then hit C-s C-s to resume the search, does that do what you want?
    – legoscia
    Mar 17, 2015 at 13:20
  • Thanks. it does. What does C-s C-s do actually?
    – Tim
    Mar 17, 2015 at 13:22
  • It starts searching for whatever you searched for with the latest C-s invocation.
    – legoscia
    Mar 17, 2015 at 13:23

2 Answers 2

3

After scrolling down, hit C-s twice. That will restart the search, using the search string from the previous time you used C-s.

1
  • 1
    While this solves OP's issue, an actual solution would be to set isearch-allow-scroll or search-exit-option. Oct 31, 2016 at 13:48
8

@legosia's answer is the usual one, and probably what you want. But be aware that there is an alternative Isearch behavior that lets you scroll the buffer being searched without exiting Isearch.

If you set (or bind) option isearch-allow-scroll to non-nil then you can scroll without exiting Isearch, as long as the current match is still on screen.

This has the advantage that you can continue to see the set of matches highlighted. The current context is maintained while you scroll.

Few are aware of this option, and probably fewer still make use of it.


Some more info about isearch-allow-scroll -

In addition to allowing scrolling, non-nil isearch-allow-scroll also has the effect of non-nil option isearch-allow-prefix (available starting with Emacs 24.4). That is, it lets you pass a prefix argument to a command that is bound to a key in isearch-mode-map. So to use a prefix argument you must set either isearch-allow-scroll or isearch-allow-prefix (if available) to non-nil. Otherwise, a prefix arg during Isearch exits Isearch.

Some Isearch enhancements, such as Isearch+, bind keys that let you make use of a prefix argument for various actions during Isearch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.