Marks and Regions

David Wilson has a new video out on efficient text selection in Emacs. You can’t really understand text selection in Emacs without understanding the mark. The basic fact is that the currently selected text—the region in Emacs lingo—is the collection of characters between the mark and the point.

Wilson explains how to select text regions by setting the mark and then moving the point. When you have a region defined, you can perform any of several operations on it. That can be anything from simple cuts and copies to more esoteric things like changing the case of every character in the region. Mostly, you learn those commands as you go along but the first thing to learn is efficient ways setting the region.

Emacs, as you’d expect, has many shortcuts to set the mark and then move the point to some predetermined place. For example, there are commands to mark the current word, paragraph, page, or buffer. There are even move specialized commands for Lisp code that deal with things like marking the current s-expression or function definition.

Of course, that’s only half the story about marks. You can also jump to them. Even more, they’re saved in a special structure called the mark ring. Thus, one can jump to the last \(n\) marks where \(n\) is the size of the mark ring. The mark ring has 16 entries by default but, being Emacs, it is, of course, configurable.

Wilson explains all this and more in the video so be sure to take a look. His demonstration of the global mark ring falters a bit at the end but it’s still a very worthwhile video. The video itself is about 28 and a half minutes so plan accordingly.

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