Variable: magit-section-keep-region-overlay
magit-section-keep-region-overlay is a customizable variable defined
in magit-section.el.
Value
nil
Documentation
Whether to keep the region overlay when there is a valid selection.
We strongly suggest that you keep the default value, nil.
By default Magit removes the regular region overlay if, and only if, that region constitutes a valid selection as understood by Magit commands. Otherwise it does not remove that overlay, and the region looks like it would in other buffers.
There are two types of such valid selections: hunk-internal regions and regions that select two or more sibling sections. In such cases Magit removes the region overlay and instead highlights a slightly larger range. All text (for hunk-internal regions) or the headings of all sections (for sibling selections) that are inside that range (not just inside the region) are acted on by commands such as the staging command. This buffer range begins at the beginning of the line on which the region begins and ends at the end of the line on which the region ends.
Because Magit acts on this larger range and not the region, it is
actually quite important to visualize that larger range. If we
don't do that, then one might think that these commands act on
the region instead. If you want to *also* visualize the region,
then set this option to t. But please note that when the region
does *not* constitute a valid selection, then the region is
*always* visualized as usual, and that it is usually under such
circumstances that you want to use a non-magit command to act on
the region.
Depending on the used theme, the magit-*-highlight-selection
faces might conflict with the region face. If that happens and
it bothers you, then you have to customize these faces to address
the conflicts.
This variable was added, or its default value changed, in magit-section version 2.3.0.
Aliases
magit-keep-region-overlay (obsolete since Magit-Section 4.0.0)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
(defcustom magit-section-keep-region-overlay nil
"Whether to keep the region overlay when there is a valid selection.
We strongly suggest that you keep the default value, nil.
By default Magit removes the regular region overlay if, and only
if, that region constitutes a valid selection as understood by
Magit commands. Otherwise it does not remove that overlay, and
the region looks like it would in other buffers.
There are two types of such valid selections: hunk-internal
regions and regions that select two or more sibling sections.
In such cases Magit removes the region overlay and instead
highlights a slightly larger range. All text (for hunk-internal
regions) or the headings of all sections (for sibling selections)
that are inside that range (not just inside the region) are acted
on by commands such as the staging command. This buffer range
begins at the beginning of the line on which the region begins
and ends at the end of the line on which the region ends.
Because Magit acts on this larger range and not the region, it is
actually quite important to visualize that larger range. If we
don't do that, then one might think that these commands act on
the region instead. If you want to *also* visualize the region,
then set this option to t. But please note that when the region
does *not* constitute a valid selection, then the region is
*always* visualized as usual, and that it is usually under such
circumstances that you want to use a non-magit command to act on
the region.
Depending on the used theme, the `magit-*-highlight-selection'
faces might conflict with the `region' face. If that happens and
it bothers you, then you have to customize these faces to address
the conflicts."
:package-version '(magit-section . "2.3.0")
:group 'magit-section
:type 'boolean)