Next: , Previous: Highlight Isearch, Up: Incremental Search


20.1.8 Scrolling During Incremental Search

Vertical scrolling during incremental search can be enabled by setting the customizable variable isearch-allow-scroll to a non-nil value.

You can then use the vertical scroll-bar or certain keyboard commands such as <PRIOR> (scroll-down), <NEXT> (scroll-up) and C-l (recenter) within the search, thus letting you see more of the text near the current match. You must run these commands via their key sequences to stay in the search—typing M-x command-name will always terminate a search.

You can give prefix arguments to these commands in the usual way. The current match cannot be scrolled out of the window—this is intentional.

Several other commands, such as C-x 2 (split-window-vertically) and C-x ^ (enlarge-window) which don't scroll the window, are nevertheless made available under this rubric, since they are likewise handy during a search.

You can make other commands usable within an incremental search by giving the command a non-nil isearch-scroll property. For example, to make C-h l usable within an incremental search in all future Emacs sessions, use C-h c to find what command it runs. (You type C-h c C-h l; it says view-lossage.) Then you can put the following line in your .emacs file (see Init File):

     (put 'view-lossage 'isearch-scroll t)

This works for commands that don't permanently change point, the buffer contents, the match data, the current buffer, or the selected window and frame. The command must not delete the current window and must not itself attempt an incremental search.