Heads up. This package is quite hacky, and I don't support anymore. Of course, you're free to use it if you want, I just won't offer support for any bugs you encounter.
Emacs package to immitate narrow-to-region
with more eye-candy.
Unlike narrow-to-region
, which completely hides text outside the narrowed region, this package simply deemphasizes the text, makes it readonly, and makes it unreachable. This leads to a much more natural feeling, where the region stays static (instead of being brutally moved to a blank slate) and is clearly highlighted with respect to the rest of the buffer.
The easiest way is to install from Melpa.
M-x package-install fancy-narrow
You can also download this file, open it in emacs, and use M-x package-install-from-buffer
.
-
Simply call
fancy-narrow-to-region
to see it in action. To widen the region again afterwards usefancy-widen
. -
If you activate the minor mode (
fancy-narrow-mode
), then the standard narrowing keys (C-x n n
,C-x n w
, etc) will make use of fancy-narrow.
To customise the face used to deemphasize unreachable text, customise fancy-narrow-blocked-face
.
Note this is designed for user interaction. For using within lisp code, the standard narrow-to-region
is preferable, because the fancy version is susceptible to inhibit-read-only
and some corner cases.