[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

12.2 Transient Mark Mode

On a terminal that supports colors, Emacs has the ability to highlight the current region. But normally it does not. Why not?

In the normal mode of use, every command that sets the mark also activates it, and nothing ever deactivates it. Thus, once you have set the mark in a buffer, there is always a region in that buffer. Highlighting the region all the time would be a nuisance. So normally Emacs highlights the region only immediately after you have selected one with the mouse.

If you want region highlighting, you can use Transient Mark mode. This is a more rigid mode of operation in which the region “lasts” only until you use it; operating on the region text deactivates the mark, so there is no region any more. Therefore, you must explicitly set up a region for each command that uses one.

When Transient Mark mode is enabled, Emacs highlights the region, whenever there is a region. In Transient Mark mode, most of the time there is no region; therefore, highlighting the region when it exists is useful and not annoying.

To enable Transient Mark mode, type M-x transient-mark-mode. This command toggles the mode; you can use the same command to turn the mode off again.

Here are the details of Transient Mark mode:

The highlighting of the region uses the region face; you can customize the appearance of the highlighted region by changing this face. Voir la section Customizing Faces.

When multiple windows show the same buffer, they can have different regions, because they can have different values of point (though they all share one common mark position). Ordinarily, only the selected window highlights its region (voir la section Multiple Windows). However, if the variable highlight-nonselected-windows is non-nil, then each window highlights its own region (provided that Transient Mark mode is enabled and the mark in the window's buffer is active).

If the variable mark-even-if-inactive is non-nil in Transient Mark mode, then commands can use the mark and the region even when it is inactive. Region highlighting appears and disappears just as it normally does in Transient Mark mode, but the mark doesn't really go away when the highlighting disappears, so you can still use region commands.

Transient Mark mode is also sometimes known as “Zmacs mode” because the Zmacs editor on the MIT Lisp Machine handled the mark in a similar way.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 23 Février 2009 en utilisant texi2html 1.78.