Subject: 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, 06 Oct 2022 11:13:03 +0300

> Date: Thu, 6 Oct 2022 09:48:12 +0200
> Cc: [email-masked], [email-masked], [email-masked]
> From: martin rudalics <[email-masked]>
> 
> With emacs -Q put the following text into *scratch*
> 
> 
> (push '(internal-region-overlay . t) window-persistent-parameters)
> 
> (defvar foo-conf nil)
> 
> (defun foo-save ()
>    (interactive)
>    (setq foo-conf (current-window-configuration)))
> 
> (defun foo-restore ()
>    (interactive)
>    (set-window-configuration foo-conf))
> 
> (split-window)
> 
> ;; (eval-buffer)
> 
> 
> evaluate it and do M-x foo-save followed by C-x o.  Move point and
> activate the region.  M-x foo-restore now gets me two overlays, one in
> the upper and one in the lower window.
> 
> Now try again with 'internal-region-overlay' not made persistent, that
> is, the first line commented out.  The same scenario gets me one (albeit
> illogical) overlay in the upper window only.

Both results in this scenario are wrong, IMO, so I don't see why we'd
prefer one of them.  I also don't understand how this scenario could
happen in real life, FWIW.