Thursday, January 29, 2009

Narrow: Emacs has a command for that

When you use the text editor Emacs, there's a continual process of finding out about new commands that you never new existed, which can be amusing

Here's one I like that I don't think is much like anything you'll see in other applications: narrow-to-region.

Suppose you're editing along, and you want to do some global edits on a chunk of text. To prevent changes to the rest of your document, you might copy the chunk to a new file and make your changes there.

In emacs, you can select the chunk (region) and use the narrow-to-region command. The system hides everything but the selection, and allows you to work on that chunk without affecting the rest of the document. 

When you use narrow, then you need to know the widen command to return to normalcy. Or you'll find yourself searching for strings and not finding any of them, when you KNOW they exist in your document...until you remember that you had made emacs narrow minded.


  1. Didn't know that one. Thanks!

  2. When you write stuff like this, I always find myself reacting as though you switched to another language in the middle of a conversation. Well, except that I don't suspect you're secretly talking about me and poking fun. But otherwise it's very similar.

    And it just hit me that (a) you're basically bilingual and (b) I was so poorly qualified to be a technical writer. If only IBM and Dell knew.

  3. Ash nazg durbataluk, ash nazg gimbatul. So it goes.