Narrowing the Fancy Way

Bruce Connor has an interesting new package up at GitHub. It’s the fancy-narrow package that, as he puts it, imitates narrow-to-region with more eye candy. At first I hated the idea. Being crotchety and grumpy, I’m inclined to treat “eye-candy” with disdain. After all, didn’t I rail against those who wanted Emacs to be prettier?

After a nice nap, though, I had second thoughts. What fancy-narrow does is identical to narrow-to-region except that instead of blanking the text outside of the narrowed region, it grays it out. The grayed out text is readonly and unreachable. The advantage of fancy-narrow is that the surrounding text is still there for context.

The disadvantage is that the surrounding text is still there. To me, the main reason for using one of the narrowing commands1 is that you see only the text you’re interested in and nothing else is there to distract you. Graying out the other text makes it less intrusive but it’s still there.

I still can’t decide if I like it enough to install but I can see how it might be helpful. What do the rest of you think? Is this something you’d find useful?



As opposed to using it programmatically as a way of making the narrowed region appear as the whole buffer as far some Elisp code is concerned.

This entry was posted in General and tagged . Bookmark the permalink.

5 Responses to Narrowing the Fancy Way

  1. Phil says:

    Interesting idea.

    At the moment it interacts badly with undo, so I wouldn’t use it (e.g.: narrow, kill text, widen, undo…) but I can see the appeal of a robust version of this. If it really was seamless, it might be a nice default, with the regular narrowing available interactively via a prefix argument (because there are absolutely times when you don’t want any other text visible).

    It also gives me an idea for improving something I was working on, which is handy :)

  2. Grant Rettke says:

    Looks like a nice option for doing formal and informal reviews.

  3. David Bjergaard says:

    Maybe instead of looking at it as “eye-candy” it would be better to look at it as “narrowing with context”? I think this is a good UI enhancement, I don’t think it qualifies as eye-candy (though its billed as such by the original author). I like narrowing to region to be able to jump to the top and bottom of the narrowed region.

    fancy-narrow would be great for short function definitions, especially if you have chain of short functions that depend on each other. You could narrow to one, and still see the context of how the others fit in.

  4. Wilfred says:

    When I first tweeted about fancy-narrow, I saw it as a good narrow-to-region-indirect substitute. After further reflection, you’re right that it’s just a narrow-to-region substitute.

    In principle narrow-to-region-indirect is more useful, since you can have multiple narrowed regions of the same buffer. I’ve never ended up using it for that, my main use case was files with multiple languages (especially HTML with inline CSS and JS) and wanting to change major mode.

    The big advantage of both narrow-to-region-indirect and fancy-narrow is usability. Narrowing is disabled by default because users find it confusing. With fancy-narrow I can see the rest of the file is still there, and with narrow-to-region-indirect I get a different buffer name (e.g. “foo.html”) and the original buffer is still available.

    So, less confusion for the user, slightly better looking, equally powerful. fancy-narrow isn’t as robust yet, but I think it’s a great package.

    • Phil says:

      narrow-to-region-indirect. Of course. Good grief. For a moment I thought this was a standard function I had somehow missed, and I see it’s actually custom, but now I can’t fathom why I never wrote it myself — I do the manual equivalent all the time… how did it not occur to me? Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>