Function: transient-mark-mode

transient-mark-mode is an interactive and byte-compiled function defined in simple.el.gz.

Signature

(transient-mark-mode &optional ARG)

Documentation

Toggle Transient Mark mode.

Transient Mark mode is a global minor mode. When enabled, the region is highlighted with the region face whenever the mark is active. The mark is "deactivated" after certain non-motion commands, including those that change the text in the buffer, and during shift or mouse selection by any unshifted cursor motion command (see Info node (emacs)Shift Selection for more details).

You can also deactivate the mark by typing C-g (keyboard-quit) or M-ESC ESC (keyboard-escape-quit).

Many commands change their behavior when Transient Mark mode is in effect and the mark is active, by acting on the region instead of their usual default part of the buffer's text. Examples of such commands include M-; (comment-dwim), M-x flush-lines (flush-lines), M-x keep-lines (keep-lines), M-% (query-replace), C-M-% (query-replace-regexp), M-x ispell (ispell), and C-x u (undo). To see the documentation of commands that are sensitive to the Transient Mark mode, invoke C-h d (apropos-documentation) and type "transient" or "mark.*active" at the prompt.

This is a global minor mode. If called interactively, toggle the Transient-Mark mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value \=transient-mark-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

View in manual

Probably introduced at or before Emacs version 19.31.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
(define-minor-mode transient-mark-mode
  "Toggle Transient Mark mode.

Transient Mark mode is a global minor mode.  When enabled, the
region is highlighted with the `region' face whenever the mark
is active.  The mark is \"deactivated\" after certain non-motion
commands, including those that change the text in the buffer, and
during shift or mouse selection by any unshifted cursor motion
command (see Info node `Shift Selection' for more details).

You can also deactivate the mark by typing \\[keyboard-quit] or
\\[keyboard-escape-quit].

Many commands change their behavior when Transient Mark mode is
in effect and the mark is active, by acting on the region instead
of their usual default part of the buffer's text.  Examples of
such commands include \\[comment-dwim], \\[flush-lines], \\[keep-lines],
\\[query-replace], \\[query-replace-regexp], \\[ispell], and \\[undo].
To see the documentation of commands that are sensitive to the
Transient Mark mode, invoke \\[apropos-documentation] and type \"transient\"
or \"mark.*active\" at the prompt."
  :global t
  ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again.
  :variable (default-value 'transient-mark-mode))