7

Is there a way to scroll through a document without exiting isearch mode? I have isearch-allow-scroll set to t, but that limits my scroll range to make sure the current isearch match is visible in the buffer. Ideally, I would like to be able to scroll with the mousewheel, having all the isearch matches highlighted as I scroll.

I am aware of M-x occur, but a lot of the time simply being able to scroll in isearch mode would be more efficient (in addition, M-x occur does not play well with folding mode).

Drew
  • 29,895
  • 7
  • 74
  • 104
Leo Alekseyev
  • 12,893
  • 5
  • 44
  • 44
  • Also, this might be related: http://stackoverflow.com/questions/589691/how-can-i-emulate-vims-search-in-gnu-emacs – Yoo Apr 09 '10 at 19:53

3 Answers3

5

There's also highlight-regexp if you want. It will highlight regexps and you can scroll as usual.

Noufal Ibrahim
  • 71,383
  • 13
  • 135
  • 169
2

It looks like what you want is not possible in general. From the documentation inside isearch.el:

;; scrolling within Isearch mode.  Alan Mackenzie (acm@muc.de), 2003/2/24
;;
;; The idea here is that certain vertical scrolling commands (like C-l
;; `recenter') should be usable WITHIN Isearch mode.  For a command to be
;; suitable, it must NOT alter the buffer, swap to another buffer or frame,
;; tamper with isearch's state, or move point.  It is unacceptable for the
;; search string to be scrolled out of the current window.  If a command
;; attempts this, we scroll the text back again.

In other words, it's not possible to scroll far enough that the search string moves out of the window.

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
  • 1
    I see. Vim's behavior is a little more sensible to me in that regard (scrolling is allowed, and "next match" takes you to the next match in the visible region). – Leo Alekseyev Mar 18 '10 at 18:17
  • @Leo I think scrolling would be nice, but I like the "next match" going anywhere (not just visible). I'm not 100%, but I think that the isearch is based off the current point, and by scrolling the current match off the screen (changing the point), that's what messes up the isearch. – Trey Jackson Mar 18 '10 at 18:21
0

Try Icicles search -- for example, icicle-occur (bound to C-' in Icicle mode).

Nothing prevents you from scrolling as far as you like with the mouse etc.

Icicles search is a different kind of incremental search. icicle-occur is like an incremental occur: as you edit your input in the minibuffer the lines are filtered by that input.

Search hit candidates are completion candidates (e.g., appear in *Completions*). You can navigate among hits in the searched buffer using C-down, or you can jump directly using C-RET or C-mouse-2.

Drew
  • 29,895
  • 7
  • 74
  • 104