Skip to main content

11.7 Disabling Transient Mark Mode

The default behavior of the mark and region, in which setting the mark activates it and highlights the region, is called Transient Mark mode. This is a minor mode that is enabled by default. It can be toggled with M-x transient-mark-mode, or with the ‘Highlight Active Region’ menu item in the ‘Options’ menu. Turning it off switches Emacs to an alternative mode of operation:

  • Setting the mark, with commands like C-SPC or C-x C-x, does not highlight the region. Therefore, you can’t tell by looking where the mark is located; you have to remember.

    The usual solution to this problem is to set the mark and then use it soon, before you forget where it is. You can also check where the mark is by using C-x C-x, which exchanges the positions of the point and the mark (see Setting Mark).

  • Some commands, which ordinarily act on the region when the mark is active, no longer do so. For example, normally M-% (query-replace) performs replacements within the region, if the mark is active. When Transient Mark mode is off, it always operates from point to the end of the buffer. Commands that act this way are identified in their own documentation.

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

Exchange point and mark, 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.

When you specify a region with the mouse (see Setting Mark), or with shift-selection (see Shift Selection), this likewise activates Transient Mark mode temporarily and highlights the region.