Subject: bug#6316: 24.0.50; unexpected region highlighting

From: Stephen Berman <[email-masked]>
Date: Tue, 24 Jun 2014 17:59:16 +0200

On Mon, 23 Jun 2014 12:31:37 -0400 Stefan Monnier <[email-masked]> wrote:

>> 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).
>
> I installed another patch into trunk which should fix this problem
> more thoroughly.  Can you confirm it fixes all the cases you know?

It does not fix the above case, though again, since that happens whether
or not transient-mark-mode is enabled, it's probably a different issue.

It does fix the case I mentioned in my previous reply of using a motion
command to unhighlight the region when transient-mark-mode is disabled,
so it improves upon the previous patch in that respect.

However, with your new patch, temporarily enabling transient-mark-mode,
when it is disabled, seems to break transient-mark-mode; here's a
recipe:

0. emacs -Q
1. Sanity check: `M-< C-SPC M-f' results in ";; This" being highlighted.
   Typing `M-x transient-mark-mode' shows the message "Transient-Mark
   mode disabled" and results in ";; This" becoming unhighlighted.
   Now typing `C-SPC M-f M-x transient-mark-mode' shows the message
   "Transient-Mark mode enabled" and results in " buffer" being
   highlighted.
2. Type `M-x transient-mark-mode' to disable transient-mark-mode again.
3. Type `C-SPC C-SPC' to temporarily enable transient-mark-mode, showing
   the message "Mark activated".
4. Type `M-x transient-mark-mode' to enable transient-mark-mode again
   (verified by the message "Transient-Mark mode enabled").
5. Type `C-SPC M-f'
=> The region is not highlighted.  Moreover, `C-h v transient-mark-mode'
   says:
   
   transient-mark-mode is a variable defined in `C source code'.
   Its value is nil
   Original value was t
   Local in buffer *scratch*; global value is t

The same thing happens if in step 3 you use shift-selection instead of
`C-SPC C-SPC'.

Steve Berman