Next: , Previous: , Up: Basic Commands   [Contents][Index]


2.2 The Mark and The Region

Each buffer has a distinguished position known as the mark. The mark initially points to the beginning of the buffer. The area between the mark and the point is known as the region. Many Hemlock commands which manipulate large pieces of text use the text in the region. To use these commands, one must first use some command to mark the region.

Although the mark is always pointing somewhere (initially to the beginning of the buffer), region commands insist that the region be made active before it can be used. This prevents accidental use of a region command from mysteriously mangling large amounts of text.

Hemlock Variable: Active Regions Enabled (initial value t)

When this variable is true, region commands beep unless the region is active. This may be set to nil for more traditional Emacs region semantics.

Once a marking command makes the region active, it remains active until:

Motion commands have the effect of redefining the region, since they move the point and leave the region active.

Commands that insert a large chunk of text into the buffer usually set an ephemerally active region around the inserted text. An ephemerally active region is always deactivated by the next command, regardless of the kind of command. The ephemerally active region allows an immediately following region command to manipulate the inserted text, but doesn’t persist annoyingly. This is also very useful with active region highlighting, since it visibly marks the inserted text.

Hemlock Variable: Highlight Active Region (initial value t)
Hemlock Variable: Active Region Highlighting Font (initial value nil)

When Highlight Active Region is true, Hemlock displays the text in the region in a different font whenever the region is active. This provides a visible indication of what text will be manipulated by a region command. Active region highlighting is only supported under X windows.

Active Region Highlighting Font is the name of the font to use for active region highlighting. If unspecified, Hemlock uses an underline font.

Command: Set/Pop Mark (bound to C-@)

This command moves the mark to the point (saving the old mark on the mark stack) and activates the region. After using this command to mark one end of the region, use motion commands to move to the other end, then do the region command. This is the traditional Emacs marking command; when running under a windowing system with mouse support, it is usually easier to use the mouse with the Point to Here and Generic Pointer Up.

For historical reasons, the prefix argument causes this command to do things that are distinct commands in Hemlock. A prefix argument of four does Pop and Goto Mark, and a prefix argument of 16 does Pop Mark.

Command: Mark Whole Buffer (bound to C-x h)
Command: Mark to Beginning of Buffer (bound to C-<)
Command: Mark to End of Buffer (bound to C->)

Mark Whole Buffer sets the region around the whole buffer, with the point at the beginning and the mark at the end. If a prefix argument is supplied, then the mark is put at the beginning and the point at the end. The mark is pushed on the mark stack beforehand, so popping the stack twice will restore it.

Mark to Beginning of Buffer sets the current region from point to the beginning of the buffer.

Mark to End of Buffer sets the current region from the end of the buffer to point.

Command: Activate Region (bound to C-x C-Space, C-x C-@)

This command makes the region active, using whatever the current position of the mark happens to be. This is useful primarily when the region is accidentally deactivated.


Next: Modification Commands, Previous: Motion Commands, Up: Basic Commands   [Contents][Index]