Emacs: Narrow the same buffer twice

Emacs allows you to split your window horizontally or vertically to display several files at the same time. It's possible to display the same file in different windows, which is nice when comparing or moving data between different parts of the file.

Emacs also allows you to narrow your window to a specific part of a file - ideal for searching and replacing a specific area only, without touching the rest.

Now I wanted to narrow the same buffer in two windows to different regions. Just running M-X narrow-to-region in both windows did not work - the narrow command in the first window also narrowed the buffer in the second window.

The people in the emacs IRC channel #emacs told me about the solution: M-X clone-indirect-buffer opens a new window with an indirect buffer that you can narrow independently from the first.

Written by Christian Weiske.

Comments? Please send an e-mail.