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

From: martin rudalics <[email-masked]>
Date: Wed, 5 Oct 2022 09:36:40 +0200

>> (push '(internal-region-overlay . t) window-persistent-parameters)
 >
 > Thanks.  Does this affect only window-swap-states, or does this affect
 > anything else?

It affects every use of window states like saving and restoring the
desktop as well as saving and restoring window configurations.

Now keeping the mark active when restoring a window configuration is
problematic in the first place since it restores the mark from the saved
state while taking point from the current state possibly ending up in
some arbitrarily specified region.  OTOH deactivating the mark in such
case is hardly feasible because restoring a window configurations should
be barely perceptible for the user.

 > If the former, I guess the above should be done
 > globally when Emacs is dumped?

I would try to get rid of the window parameter used here.  Active region
highlighting is an activity that affects the selected window only and
not any window.  The 'window' property of any overlay used for it must
always refer to the selected window and not any other window.  So I see
no use for window parameters here which are mainly useful for overriding
a global variable or the local value of the buffer shown in a window.

I'd rather use one global overlay and move it (by setting its 'window'
property) whenever 'window-selection-change-functions' tell me that the
selected window has changed.  But maybe I'm missing something here.

martin