ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

11.7 Persistent Marks

By default, the mark is activated by setting it, and deactivated by most non-motion commands (including all commands that change the text in the buffer). This behavior is called Transient Mark mode1.

Turning off Transient Mark mode switches Emacs to an alternative mode of operation, which was the default prior to Emacs 23. When Transient Mark mode is off, the mark is never deactivated, but it can be set to different locations using commands such as C-<SPC>. Emacs does not highlight the region, because that would be a nuisance. As a special exception, the region is temporarily highlighted if you set it with the mouse (see Setting Mark), or with shift-selection (see Shift Selection).

To turn off Transient Mark mode, type M-x transient-mark-mode. This command toggles the mode; you can use the same command to turn it on again. You can also toggle Transient Mark mode using the ‘Active Region Highlighting’ menu item in the ‘Options’ menu.

Here are the details of how Emacs behaves when Transient Mark mode is off:

While Transient Mark mode is off, you can activate it temporarily using C-<SPC> C-<SPC> or C-u C-x C-x.

C-<SPC> C-<SPC>
Set the mark at point (like plain C-<SPC>) and enable Transient Mark mode just once, until the mark is deactivated. (This is not really a separate command; you are using the C-<SPC> command twice.)
C-u C-x C-x
Activate the mark and enable Transient Mark mode temporarily, until the mark is next deactivated. (This is the C-x C-x command, exchange-point-and-mark, with a prefix argument.)

These commands set or activate the mark, and enable Transient Mark mode only until the mark is deactivated. One reason you may want to use them is that some commands operate on the entire buffer instead of the region when Transient Mark mode is off. Enabling Transient Mark mode momentarily gives you a way to use these commands on the region.

Footnotes

[1] It is also sometimes called Zmacs mode, because the Zmacs editor on the MIT Lisp Machine handled the mark in a similar way.

blog comments powered by Disqus