Skip to main content

20.7 Convenience Features for Window Handling

Winner mode is a global minor mode that records the changes in the window configuration (i.e., how the frames are partitioned into windows), so that you can undo them. You can toggle Winner mode with M-x winner-mode, or by customizing the variable winner-mode. When the mode is enabled, C-c left (winner-undo) undoes the last window configuration change. If you change your mind while undoing, you can redo the changes you had undone using C-c right (M-x winner-redo). To prevent Winner mode from binding C-c left and C-c right, you can customize the variable winner-dont-bind-my-keys to a non-nil value. By default, Winner mode stores a maximum of 200 window configurations per frame, but you can change that by modifying the variable winner-ring-size. If there are some buffers whose windows you wouldn’t want Winner mode to restore, add their names to the list variable winner-boring-buffers or to the regexp winner-boring-buffers-regexp.

Follow mode (M-x follow-mode) synchronizes several windows on the same buffer so that they always display adjacent sections of that buffer. See Follow Mode.

The Windmove package defines commands for moving directionally between neighboring windows in a frame. M-x windmove-right selects the window immediately to the right of the currently selected one, and similarly for the left, up, and down counterparts. M-x windmove-default-keybindings binds these commands to S-right etc.; doing so disables shift selection for those keys (see Shift Selection). In the same way as keybindings can be defined for commands that select windows directionally, you can use M-x windmove-display-default-keybindings to define keybindings for commands that specify in what direction to display the window for the buffer that the next command is going to display. Also there is M-x windmove-delete-default-keybindings to define keybindings for commands that delete windows directionally, and M-x windmove-swap-states-default-keybindings that defines keybindings for commands that swap the window contents of the selected window with the window in the specified direction.

The command M-x compare-windows lets you compare the text shown in different windows. See Comparing Files.

Scroll All mode (M-x scroll-all-mode) is a global minor mode that causes scrolling commands and point motion commands to apply to every single window.