Subject: bug#6316: 24.0.50; unexpected region highlighting

From: Stephen Berman <[email-masked]>
Date: Tue, 27 May 2014 22:51:48 +0200

On Tue, 27 May 2014 11:00:12 -0400 Stefan Monnier <[email-masked]> wrote:

>> Could someone who knows how region highlighting works take a look at
>> this issue, which continues to annoy me?
>
> I installed a patch which fixes this particular recipe,

I confirm that the unexpected highlighting with the recipe of my OP is
gone, thanks much.

>                                                         but this is
> a very messy part of transient-mark-mode, so I wouldn't be surprised if
> there are other problematic cases.

Indeed, the recipe David De La Harpe Golden gave still produces
unexpected highlighting (though, despite being phenomenologically the
same sort of problem, maybe it's technically different, since it happens
even with transient-mark-mode enabled).

Your patch also does not account for the case of using a motion command
to unhighlight the region when transient-mark-mode is disabled, instead
of using M-w to do that as in my OP.  The reason is apparently that
moving point does not deactivate the mark, unlike M-w or C-g, so your
fix does not come into play.  It's clear that motion commands should not
deactivate the mark when transient-mark-mode is enabled, since they
change the bounds of the active region.  But when transient-mark-mode is
disabled but then temporarily enabled by double clicking or shift
selection, thus highlighting the region, and moving point unhighlights
the region, doesn't it seem reasonable to deactivate the mark in this
case?

Steve Berman