Subject: Re: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay

From: Eli Zaretskii <[email-masked]>
Date: Thu, 29 Sep 2022 22:19:34 +0300

> From: <[email-masked]>
> Cc: [email-masked]
> Date: Thu, 29 Sep 2022 21:17:56 +0200
> 
> >> 1. 'C-h e' to display *Messages* in a new window
> >> 2. 'C-SPC C-n' to mark an active region
> >> 3. 'M-x window-swap-states'
> >> 4. 'C-g C-n' to deactivate the mark
> >> 
> >> Notice how the region overlay stays there.
> >
> > "There" where?
> 
> In the *GNU Emacs* buffer, where we have originally marked a region in
> step 2.
> 
> > What did you expect to happen in the above scenario, and why?
> 
> I expect the overlay to disappear after deactivating the mark with 'C-g'
> in step 4.

Ah!  Now it's clear what this issue is about.

The problem is that deactivate-mark doesn't work in this case, for
some reason, and neither is setting mark-active to nil.