Narrowing means focusing in on some portion of the buffer, making the rest temporarily inaccessible. The portion which you can still get to is called the accessible portion. Canceling the narrowing, which makes the entire buffer once again accessible, is called widening. The bounds of narrowing in effect in a buffer are called the buffer’s restriction.
Narrowing can make it easier to concentrate on a single subroutine or paragraph by eliminating clutter. It can also be used to limit the range of operation of a replace command or repeating keyboard macro.
Narrow down to between point and mark (
Widen to make the entire buffer accessible again (
Narrow down to the current page (
Narrow down to the current defun (
When you have narrowed down to a part of the buffer, that part appears to be all there is. You can’t see the rest, you can’t move into it (motion commands won’t go outside the accessible part), you can’t change it in any way. However, it is not gone, and if you save the file all the inaccessible text will be saved. The word ‘Narrow’ appears in the mode line whenever narrowing is in effect.
The primary narrowing command is C-x n n (
It sets the current buffer’s restrictions so that the text in the current
region remains accessible, but all text before the region or after the
region is inaccessible. Point and mark do not change.
Alternatively, use C-x n p (
narrow-to-page) to narrow
down to the current page. See Pages, for the definition of a page.
C-x n d (
narrow-to-defun) narrows down to the defun
containing point (see Defuns).
The way to cancel narrowing is to widen with C-x n w
widen). This makes all text in the buffer accessible again.
You can get information on what part of the buffer you are narrowed down to using the C-x = command. See Position Info.
Because narrowing can easily confuse users who do not understand it,
narrow-to-region is normally a disabled command. Attempting to use
this command asks for confirmation and gives you the option of enabling it;
if you enable the command, confirmation will no longer be required for
it. See Disabling.