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: Thu, 6 Oct 2022 09:48:12 +0200

> In the scenario described in this bug report, point is copied to the
 > new window, so the result is as expected.  Deactivating the mark also
 > does the expected job.  So it looks like adding
 > internal-region-overlay to the persistent window parameters is a good
 > solution in this case.  I suggest that you try that, maybe you will
 > see some problems that I missed.

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.

martin