GNU logs - #58175, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: miha@HIDDEN
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 29 Sep 2022 17:17:02 +0000
Resent-Message-ID: <handler.58175.B.166447177311916 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 58175 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.166447177311916
          (code B ref -1); Thu, 29 Sep 2022 17:17:02 +0000
Received: (at submit) by debbugs.gnu.org; 29 Sep 2022 17:16:13 +0000
Received: from localhost ([127.0.0.1]:39515 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1odx8u-000368-Db
	for submit <at> debbugs.gnu.org; Thu, 29 Sep 2022 13:16:12 -0400
Received: from lists.gnu.org ([209.51.188.17]:35384)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <miha@HIDDEN>) id 1odx8o-00035x-FG
 for submit <at> debbugs.gnu.org; Thu, 29 Sep 2022 13:16:11 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45068)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <miha@HIDDEN>)
 id 1odx8o-0001X9-4P
 for bug-gnu-emacs@HIDDEN; Thu, 29 Sep 2022 13:16:06 -0400
Received: from kamnitnik.top ([2001:19f0:5001:bf2:5400:2ff:fee0:2626]:59942)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <miha@HIDDEN>)
 id 1odx8j-0002df-Q9
 for bug-gnu-emacs@HIDDEN; Thu, 29 Sep 2022 13:16:05 -0400
From: miha@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top;
 s=mail; t=1664471758;
 bh=2Pbjju8HydcminQHX40efTF+3LdpjYyuviNMtDeVnd0=;
 h=From:To:Subject:Date:From;
 b=xfc5adFV7w5nKnTziPaBKn4V92ONC09f3uW4ctmuarDxVkMfs+NyWkfL6P9lb4kCt
 Pyh6W63tVD0i9Ugn2H7NZUH3hFTWIJMKGaH7Yjwa7yV3wYNQqdM6pBJGRFcUTtFCMu
 MlYnsaXjjpQOorOQCnfkfsv1jLWQmOLKM3QqNS5TU/u4J7Wgp57JYmT13j2u1zyCeC
 vZdvUamnqNAG9WUcRDb6IDIxnpFVa3bWBqhXpBtMQ/rYYg9w/7yIAuQOBgH2JZriqT
 Ci0Ctj92+sr8px8nkscbimuijWn1Pkc3Ef3zZruayOw6Qi4TehG13Xz2I6jGy3ZAFv
 Z6470gmBwnNaQ==
Date: Thu, 29 Sep 2022 19:29:46 +0200
Message-ID: <86sfkaay2d.fsf@miha-pc>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
Received-SPF: pass client-ip=2001:19f0:5001:bf2:5400:2ff:fee0:2626;
 envelope-from=miha@HIDDEN; helo=kamnitnik.top
X-Spam_score_int: 0
X-Spam_score: -0.1
X-Spam_bar: /
X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FROM_SUSPICIOUS_NTLD=0.001, FROM_SUSPICIOUS_NTLD_FP=1.999,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001,
 T_PDS_OTHER_BAD_TLD=0.01 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 2.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  emacs -q: 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. 
 Content analysis details:   (2.6 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,
 medium trust [209.51.188.17 listed in list.dnswl.org]
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: kamnitnik.top (top)]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.9 SPF_FAIL               SPF: sender does not match SPF record (fail)
 [SPF failed: Please see http://www.openspf.org/Why?s=mfrom;
 id=miha%40kamnitnik.top; ip=209.51.188.17; r=debbugs.gnu.org]
 2.0 FROM_SUSPICIOUS_NTLD_FP From abused NTLD
 0.0 FROM_SUSPICIOUS_NTLD   From abused NTLD
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

emacs -q:

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.

To make this easier to debug, instrument 'window-swap-states' by
applying the following diff

diff --git a/lisp/window.el b/lisp/window.el
index 905803b19e..daddd18b74 100644
=2D-- a/lisp/window.el
+++ b/lisp/window.el
@@ -6518,8 +6518,14 @@ window-swap-states
            (height-2 (and height (window-text-height window-2 t)))
            old preserved)
       ;; Swap basic states.
+      (message "Before %S \n %S"
+               (window-parameter window-1 'internal-region-overlay)
+               (window-parameter window-2 'internal-region-overlay))
       (window-state-put state-1 window-2 t)
       (window-state-put state-2 window-1 t)
+      (message "After: %S \n %S"
+               (window-parameter window-1 'internal-region-overlay)
+               (window-parameter window-2 'internal-region-overlay))
       ;; Swap overlays with `window' property.
       (with-current-buffer (window-buffer window-1)
         (dolist (overlay (overlays-in (point-min) (point-max)))

Follow the bug recipe and notice the following messages:

Before: #<overlay from 77 to 123 in *GNU Emacs*>=20
 nil
After: nil=20
 nil

window-state-put sets 'internal-region-overlay' window parameter to nil
without removing the actual region overlay, so it remains there in the
buffer. I'm not sure how to fix this. Perhaps we should add
'internal-region-overlay' to 'window-persistent-parameters'? Are other
commands that use window-state-get + window-state-put affected by this
bug as well?

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.34, cairo version 1.17.6) of 2022-09-29 built on miha-pc
Repository revision: 0edd7770e0ce70cac59f239134962d10f48dec79
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Arch Linux

Configured using:
 'configure -C --prefix=3D/usr --without-libsystemd
 --enable-checking=3Dyes,glyphs --enable-check-lisp-object-type
 'CFLAGS=3D-O0 -g3''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11
XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Shell

Minor modes in effect:
  shell-dirtrack-mode: t
  comint-fl-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils sh-script smie
executable files-x shell pcomplete comint osc ansi-color ring tabify
thingatpt help-fns radix-tree help-mode cus-edit pp cus-start cus-load
icons wid-edit time-date subr-x cl-loaddefs cl-lib rmc iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 77394 9282)
 (symbols 48 8002 0)
 (strings 32 23223 1949)
 (string-bytes 1 634193)
 (vectors 16 13518)
 (vector-slots 8 208026 15295)
 (floats 8 46 42)
 (intervals 56 1050 0)
 (buffers 1000 16))

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmM11gsTHG1paGFAa2Ft
bml0bmlrLnRvcAAKCRCzCRoakhWZP95mD/9HyGBDiujDacibWLTzAm2iWiI1JOIE
AmxtF9iQsJ7qgxANePGxHBapSkbkOTeTEiB+q1l1KKxP3L1OOgK/pUP7FxX6FOJN
R2/q/X9ym/+h+1C4hosAKSFbMLpBK3JK4VDn0K14PNQpeBui0JoD241QDsuGI14s
xTNLbp1BskpKGjCeo5rrNMCxPlM3OPmey/C/5Lw+GjtREZWpgKt40f6SlL6N+FsE
/GPG4fZ64RKUARhPYgn3pjD3CgP3S1sqTtFp6IcqEKFaFeJL4NKB0ZC+ZLU4hbm2
QWXCraaj6E+UIDK+y5jrQWXL1smFymDklreTDbUXocoD+aCo4SDZq4Fg5xH9p3Wm
2xqBIE+RN/InPqzq95Y161voCQYuB8Jgty/Q+bZdhnw/Ric7lfCChh7dZ4lY+lK0
xCVNaLnFIDuB1tWzRlSxYwVM/15DBiTH9lb4Mbg+b9Uiezn4fAyi1P35fOP7xVpq
x2+F6epdepy+Zhmj9DkL2i1dv6ysdTMLTrOUoWHR6W820vbVs1M8Fyppgxjuzx9f
Fcz8o2BFv3642CzdzokHinmsMzwbPuUGHxyimLGxytjRaa/u7RxiArdAd7zgnwuB
ed9INnjymFd3sB7NM6TSCIuPsnh6ELqIF3R6CGtg8mC1ojXQSjz108ykiMN657Mo
sIKD/IUfCvTdGQ==
=3vKK
-----END PGP SIGNATURE-----
--=-=-=--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: miha@HIDDEN
Subject: bug#58175: Acknowledgement (29.0.50; M-x window-swap-states
 during an active mark leaves behind a region overlay)
Message-ID: <handler.58175.B.166447177311916.ack <at> debbugs.gnu.org>
References: <86sfkaay2d.fsf@miha-pc>
X-Gnu-PR-Message: ack 58175
X-Gnu-PR-Package: emacs
Reply-To: 58175 <at> debbugs.gnu.org
Date: Thu, 29 Sep 2022 17:17:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 58175 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
58175: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D58175
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 29 Sep 2022 18:36:01 +0000
Resent-Message-ID: <handler.58175.B58175.166447652919635 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: miha@HIDDEN
Cc: 58175 <at> debbugs.gnu.org
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166447652919635
          (code B ref 58175); Thu, 29 Sep 2022 18:36:01 +0000
Received: (at 58175) by debbugs.gnu.org; 29 Sep 2022 18:35:29 +0000
Received: from localhost ([127.0.0.1]:39577 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1odyNc-00056c-Qy
	for submit <at> debbugs.gnu.org; Thu, 29 Sep 2022 14:35:29 -0400
Received: from eggs.gnu.org ([209.51.188.92]:35754)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1odyNY-00056L-NA
 for 58175 <at> debbugs.gnu.org; Thu, 29 Sep 2022 14:35:27 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:40948)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1odyNQ-0008Qi-5D; Thu, 29 Sep 2022 14:35:19 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=FDC2XzPIoy0+Bxm3y/mD6JviivNfPJNdeFg3V3U+S2g=; b=h2fnI49A34Ji
 mPMPegG/1hMJW4sPP8hvwZebaHoImnP1EV5Burr+t5DUTKCxHTs8pjC/pfaR0FBKd5cAOxQq5R0Od
 aWKzVkXtJ8DP92XUbk3nZm6+uwnshusb4aA6F6f+5LoD4tC3AOFc+aB9RbFT1POAy7AERen9nHUwx
 iKNrbzp5DdFdEndp8K+AabeXt/PppSGVtJowsmxuYCnYLi3F/fWyfAJ12WfQTtzRlh3R7Rcy2+qDX
 IjpJC1XQLnL0Tpc30v0Eveam/4ByjsMobFfG4fsB4t21Qx34cyvOKR2VtStro+N96l7f2lMlURX8B
 K9K3eiYhk2Vs2BZ+XnWmgA==;
Received: from [87.69.77.57] (port=3770 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1odyNI-0007tF-KJ; Thu, 29 Sep 2022 14:35:14 -0400
Date: Thu, 29 Sep 2022 21:34:59 +0300
Message-Id: <83a66if2r0.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <86sfkaay2d.fsf@miha-pc> (bug-gnu-emacs@HIDDEN)
References: <86sfkaay2d.fsf@miha-pc>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Thu, 29 Sep 2022 19:29:46 +0200
> From: miha--- via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> 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?

What did you expect to happen in the above scenario, and why?

> window-state-put sets 'internal-region-overlay' window parameter to nil
> without removing the actual region overlay

Where in the code do you see that?  I see this:

      (with-current-buffer (window-buffer window-1)
        (dolist (overlay (overlays-in (point-min) (point-max)))
          (let ((window (overlay-get overlay 'window)))
            (cond
             ((not window))
             ((eq window window-1)
              (overlay-put overlay 'window window-2))
             ((eq window window-2)
              (overlay-put overlay 'window window-1))))))

AFAIU, this _swaps_ the 'window' property of the overlays, so that the
overlay now belongs (and should be visible) in the other window.
Which is what I should expect.

What am I missing?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: <miha@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 29 Sep 2022 19:05:01 +0000
Resent-Message-ID: <handler.58175.B58175.166447824822391 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 58175 <at> debbugs.gnu.org
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166447824822391
          (code B ref 58175); Thu, 29 Sep 2022 19:05:01 +0000
Received: (at 58175) by debbugs.gnu.org; 29 Sep 2022 19:04:08 +0000
Received: from localhost ([127.0.0.1]:39592 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1odypM-0005p5-2z
	for submit <at> debbugs.gnu.org; Thu, 29 Sep 2022 15:04:08 -0400
Received: from kamnitnik.top ([209.250.245.214]:50586)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <miha@HIDDEN>) id 1odypI-0005ot-Rw
 for 58175 <at> debbugs.gnu.org; Thu, 29 Sep 2022 15:04:06 -0400
From: <miha@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top;
 s=mail; t=1664478242;
 bh=xGbKTKvkhFLsXiTM9d1vkZKES+vD44TTqf3WZEKAZm0=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=b3EIAgm5SgasYeBVUbvUXy0ow0aRgGkuyUNjOwLbY+3eA7AqFiwkiD43rVUDql7ic
 qIY3UwAhRTk+NzqGGb2ErJpzfu9A8uM3FKGkquc9qJpLFxOk08HrynkZjRBTynKauY
 SvGpC2xdhHf7frYuB8ksoYXnW34B6IvbXIx3d62EICHZdbh5HIJHw1BTciLh62ElTh
 La3Mu45vthQc2nj6Sj0tORgFU+ek2pn5WQG9ZXeGEUpmKahrh9+kDqZczVBWv/muwe
 PEAQSdTn0kIp76ydMPTy4UF5WsgXMdIaK1pEEd2ZldHm7XUKGg0n4jfLK5nv+TkEDz
 05jcDLw/CuRPg==
In-Reply-To: <83a66if2r0.fsf@HIDDEN>
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
Date: Thu, 29 Sep 2022 21:17:56 +0200
Message-ID: <8735cauh0b.fsf@miha-pc>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Eli Zaretskii <eliz@HIDDEN> writes: >> Date: Thu, 29 Sep
 2022 19:29:46 +0200 >> From: miha--- via "Bug reports for GNU Emacs, >> the
 Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> >> >> 1. 'C-h e'
 to display *Messages* in a n [...] 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: kamnitnik.top (top)]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.0 FROM_SUSPICIOUS_NTLD   From abused NTLD
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Eli Zaretskii <eliz@HIDDEN> writes: >> Date: Thu, 29 Sep
   2022 19:29:46 +0200 >> From: miha--- via "Bug reports for GNU Emacs, >> the
    Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> >> >> 1. 'C-h e'
    to display *Messages* in a n [...] 
 
 Content analysis details:   (2.0 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
  2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: kamnitnik.top (top)]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
  1.0 BULK_RE_SUSP_NTLD      Precedence bulk and RE: from a suspicious TLD
  0.0 FROM_SUSPICIOUS_NTLD   From abused NTLD
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Thu, 29 Sep 2022 19:29:46 +0200
>> From: miha--- via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>=20
>> 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
>>=20
>> 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.

>> window-state-put sets 'internal-region-overlay' window parameter to nil
>> without removing the actual region overlay
>
> Where in the code do you see that?  I see this:
>
>       (with-current-buffer (window-buffer window-1)
>         (dolist (overlay (overlays-in (point-min) (point-max)))
>           (let ((window (overlay-get overlay 'window)))
>             (cond
>              ((not window))
>              ((eq window window-1)
>               (overlay-put overlay 'window window-2))
>              ((eq window window-2)
>               (overlay-put overlay 'window window-1))))))
>
> AFAIU, this _swaps_ the 'window' property of the overlays, so that the
> overlay now belongs (and should be visible) in the other window.
> Which is what I should expect.

Indeed the overlay is shown in the correct window after step 3. The
problem is that it doesn't disappear after step 4
('redisplay--update-region-highlight' doesn't remove it).

> What am I missing?

Perhaps you forgot to deactivate the mark in step 4? If there is
anything unclear in the bug recipe, go ahead and ask.

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmM172QTHG1paGFAa2Ft
bml0bmlrLnRvcAAKCRCzCRoakhWZP1a0D/9WkK43EAiSf6/Eb4Mj9+r1VifEdeta
G1HJ6kJG6mXZKVCS5Q9O3tPIw8I14GpJ+4Ic3oSvtgusNkADumOZJRSon9OEZidh
OVfNvy/sZefr2N9J8uuEzeODHF1JaUZ5e+2BXqSGFl9PQI/p5JpZyr5l5jKXzelu
2oUOMBnWiufEo9bQQGCwfyM4hphMDr5ZO99y6uHYBRZgGLuDAKZJK6nwgiF/lXYK
mjZxRq7J3M7LflV5nff2+bU0XrU0zp+CX3uxhASIewI/RKpWfQDf02cva21v6gB5
StSuObcGZECLCfh9ZOQFYLWB6Pw7s1QnsjqOH6t9XhuhhqG/ikAioRUjCeQeDpeA
yXFg2tZMfzu+PbC3H7MO/CHysveQoZcCEogYxnbaJJuL93WXCEYrZR2ads0Tm14d
miqU3RdebJH4LVWWSLz/B/vZMJzJ4ol+GyDnp7og9KLCPIQ1RJaXX5T1psLm8C9r
7JSZY0mh/tEKy3ghyI5UvkPvb7CWJ+C96UydzEqTL4FwLGVzh9uh+XS5PzOitS9f
3IpSjZBfc/wGQtkOIvV1CWQ7AeQ1TkqYf7KTC0OsyC3srTd4TcV8ewn1k1MtYYc2
GNr1NBtoUZYccmCkDtZBI+T3MTfJjr5Z6MKD/4+XwlybLriPWp4dZ1nOH7ojTnNe
/sruGKMAP0ih7w==
=G34U
-----END PGP SIGNATURE-----
--=-=-=--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 29 Sep 2022 19:20:02 +0000
Resent-Message-ID: <handler.58175.B58175.166447919623847 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: <miha@HIDDEN>
Cc: 58175 <at> debbugs.gnu.org
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166447919623847
          (code B ref 58175); Thu, 29 Sep 2022 19:20:02 +0000
Received: (at 58175) by debbugs.gnu.org; 29 Sep 2022 19:19:56 +0000
Received: from localhost ([127.0.0.1]:39617 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1odz4d-0006CY-Lc
	for submit <at> debbugs.gnu.org; Thu, 29 Sep 2022 15:19:55 -0400
Received: from eggs.gnu.org ([209.51.188.92]:56650)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1odz4Z-0006CK-MS
 for 58175 <at> debbugs.gnu.org; Thu, 29 Sep 2022 15:19:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:33122)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1odz4T-0006px-JX; Thu, 29 Sep 2022 15:19:45 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=E8luZrCuXgJ1MXyrNMhdOQ5FG3uSydMbW/+v4sCHq/8=; b=p3/pADrtmi9m
 WHoIfC2yvFcFV0FytG9LcMYFckfM1IdSKSwZUMMjA7B+J1sz8GF9pS1DZw9/2iSeTISnhov0guuJb
 GWeusifTYdeHZlLM4flzkfsPl/7EROg7/3KlCZz9jxR1APHMvtWUjLM4T1ifi1nDkH7FkjIzH19Tr
 /T7qDjolFzvfY2l6lfNklUP/3ZevOLYycHmv4MzRPrED5CUeh5NXV5jHojoNynPbJhVDfbmOrcANV
 nSHoiPLl8j/7rdULP2BTbbQPK6qcUVg/c8JX2tVDfht8innfVQUpHyJawQzSUgbUlc8afLrMM8TPV
 oh0EwWxQtIiQ73mzbrtynw==;
Received: from [87.69.77.57] (port=2532 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1odz4S-0004eb-5z; Thu, 29 Sep 2022 15:19:45 -0400
Date: Thu, 29 Sep 2022 22:19:34 +0300
Message-Id: <837d1mf0op.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <8735cauh0b.fsf@miha-pc>
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc>
X-Spam-Score: -0.3 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> From: <miha@HIDDEN>
> Cc: 58175 <at> debbugs.gnu.org
> 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.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 02 Oct 2022 16:51:02 +0000
Resent-Message-ID: <handler.58175.B58175.166472943029735 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: miha@HIDDEN, martin rudalics <rudalics@HIDDEN>
Cc: 58175 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166472943029735
          (code B ref 58175); Sun, 02 Oct 2022 16:51:02 +0000
Received: (at 58175) by debbugs.gnu.org; 2 Oct 2022 16:50:30 +0000
Received: from localhost ([127.0.0.1]:47904 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1of2Ag-0007jV-6G
	for submit <at> debbugs.gnu.org; Sun, 02 Oct 2022 12:50:30 -0400
Received: from eggs.gnu.org ([209.51.188.92]:43838)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1of2Ae-0007jA-J5
 for 58175 <at> debbugs.gnu.org; Sun, 02 Oct 2022 12:50:29 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:51300)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1of2AY-0008OW-4C; Sun, 02 Oct 2022 12:50:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=JRukxhDc8X96i3ZFjB74h40bljlSnofs/upLjvbcwqk=; b=ZURk6q7k08SL
 dWBPbjWRVD+dIZ4pqBkFeVG7FrY66ruawBLfdZsvf9F1LpA4QMOCLH5cwSmIa/AFIgYABEM04GX3+
 0my9jteqfEN0Xn8qTH9fPBA0IvJSjNEiOcJDqoNqaRQ8WOghOLl2GRLhi1z1cKFQwenAfF3eYILV2
 Q6X5YgyIrAYWiG0heoj0kehjr3tpxZXeTtKKMl50uSSTIj/BTkRGiOzhiCOVh8YLol2tCkzVBNwWR
 ccRUVlZ8qGDT9N3WTQMxau9nEWjQsGPo2IhPPzpX9Hs5MXuaBjUNTtCbpG5mQBs1lt6m0HDpDY3ec
 nOuwL1ld8Q7hxvLboQU81A==;
Received: from [87.69.77.57] (port=1958 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1of2AX-00054m-JR; Sun, 02 Oct 2022 12:50:21 -0400
Date: Sun, 02 Oct 2022 19:50:13 +0300
Message-Id: <83fsg6186y.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <837d1mf0op.fsf@HIDDEN> (message from Eli Zaretskii on Thu, 29
 Sep 2022 22:19:34 +0300)
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN>
X-Spam-Score: -0.3 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> Cc: 58175 <at> debbugs.gnu.org
> Date: Thu, 29 Sep 2022 22:19:34 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > From: <miha@HIDDEN>
> > Cc: 58175 <at> debbugs.gnu.org
> > 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.

Looks like the internal-region-overlay window parameter, which is
important for correct workings of region-highlight, isn't copied
correctly to the other window as part of swapping state, because its
value ends up as "overlay N in no buffer", i.e. the overlay's buffer
is lost in transition.

Martin, Stefan: any suggestions or ideas?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: martin rudalics <rudalics@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 04 Oct 2022 08:25:01 +0000
Resent-Message-ID: <handler.58175.B58175.166487184323939 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>, miha@HIDDEN
Cc: 58175 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166487184323939
          (code B ref 58175); Tue, 04 Oct 2022 08:25:01 +0000
Received: (at 58175) by debbugs.gnu.org; 4 Oct 2022 08:24:03 +0000
Received: from localhost ([127.0.0.1]:52399 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ofdDe-0006E3-Vo
	for submit <at> debbugs.gnu.org; Tue, 04 Oct 2022 04:24:03 -0400
Received: from mout.gmx.net ([212.227.17.20]:45887)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1ofdDd-0006DX-A3
 for 58175 <at> debbugs.gnu.org; Tue, 04 Oct 2022 04:24:01 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1664871831;
 bh=2UW/nfYggz4zdTiO49c7HicdCpZfG+Xcc7A64mi34S8=;
 h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To;
 b=AH8Cc6nZWYmK1VAskgbAz+BXDTm7E8GzbIMmrpBrlwbuSOFqBXk0Alyyo7wGf+O5D
 UKCH7DIp6MwvbLqpu2FhJY/dL5Nsa3QO7c2VgJSDovlBqtnJfjKPM8IBoyURneMK2W
 NTQi1TikH4P6SJMAE0zxdcS3R2fuWG386mUDm0MM=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.100] ([46.125.249.89]) by mail.gmx.net (mrgmx105
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MA7KU-1oU2dp2x5O-00BZrg; Tue, 04
 Oct 2022 10:23:51 +0200
Message-ID: <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN>
Date: Tue, 4 Oct 2022 10:23:49 +0200
MIME-Version: 1.0
Content-Language: en-US
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN> <83fsg6186y.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
In-Reply-To: <83fsg6186y.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:26cSwD5cZmHbLit+pcm9l/6SV8iAxCLJLZKKyLQh0lkqfJPPdzU
 dY7hKEkbjRRZSzEoRSu/WRFROZY8g7rqFQac5GXF4G7vyNMJEU2THrL9z7jmw2KVSasC8y4
 /xInLs8MMXmAOgu38AL0ZSeJP6+/FDtRSStFUjyt+tSjO8nVMvWwxDq0I8tgxJX6rpsJJ0+
 GqgO+Sxvk34Cg8NHJBB3g==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:qrykIaHQANY=:YPEX4QzmJ035o7DjYsMfxk
 /hRB0Al0eNMI/xDYajxsQTV7RRrOh/LQiR4Ql7AWKt/LwmxJOUhonsI5DBRo1ZHFW1oLWjvq2
 v47tb29AJ1tmHp8TFOAMFHBvzHxwugbcRjz0UZEOEWQB0Wpv7VfnG+GJywjblBwx5iGrVlTDk
 ooxbp2iVbRSabwwF0Y1zB0ItKuTJ8x0NRbjAZez/9/EY0Q3xXapBV9keEURaSmfyzgUd2H30r
 5xKWbS7GQrycQEizS/Yh5HNHAL5pq6ZujV1f/gA6p8aBu4XcUxvmEuuES04XfWpNEL4NYdaX1
 jfqvsQB/MynkL726H3/Jimf/C7LiGCK8HjurAVsuHltYSYNk/ntM+8g3Rzz6bL1vOBuZ9R/Ae
 sBGUKJqoeED1JsAKoGolOeiC32vHNXYnT14pP/UvaXHMPKT9fQ3tJLQ4/5Nru7qD4hxaqx4SK
 HI46WmJt9SWUEReA+E61bKWdQ13kqtycGEj59wFpSSSBwy9nQjGHUFWakGuMdhcMe3FwYVJwh
 l3+xNAAYTiHV8cj+Pb/U83ulqNZIJ3xY8Fpe3iYN544VJgo/04TIuyZC1vaAltLwG6mUxU2Sr
 flEvrdQVHcmVfN4JIdh7LwMOOWNUpDgZeo+CdWMuK999t81HDPBcqcSfRPgoDRGfFY9xSsWhr
 p1KUsl34Wga4zFgjnECx6u6PSZOLxfzFQN4V8+VX1k45cQ46xk4y7E3t5gqt3/sCo18WvOBbj
 ovs+QMZ9NURWqY5Pr3ekEKYqmkgrIBe06z69O6VTmj3H2UaQy4GijXl/B1ItKT24kG8Yn9aKn
 gt/kuMHhxJgyGyHeqZ3Rvpsp93pHYpjlxazo0QVL7UlYo7C196bOFZ7IndKaB3aKeEBSshal+
 qT7Y+mos7qp/so7vAplZSkIkqnynlWle1xvMj3LlmYN85474A4D223cbYgeYCcroaOC+4C+mj
 e/EQBTWVwTXhlUQQqk8GaHtGqW77jc3YpLpxcH0oMCjsm6P2IFfyuFu0uDJZvv3CK5+xMP+jY
 XFCd5VsHAWwPMkayhZQZ0ad2X+gl61BJ+2cgCn/UKNKFyNYoo0T1Q7TLjhPf2mk1A6zF8IKLB
 E7Y3q+0zFIuNaPJQeEizXoaa6OkGRVb7yn+a9qGRTX2kSEuG//i9nHXXKH9OvzTfwuxmEersS
 /IaR0z3b/ZWXJhPQT5YNZhmyzW
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

 > Looks like the internal-region-overlay window parameter, which is
 > important for correct workings of region-highlight, isn't copied
 > correctly to the other window as part of swapping state, because its
 > value ends up as "overlay N in no buffer", i.e. the overlay's buffer
 > is lost in transition.

If you want a window parameter to get copied when swapping window states,
you have to explicitly mark it as "persistent".  For example with:

(push '(internal-region-overlay . t) window-persistent-parameters)

martin




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 04 Oct 2022 16:55:01 +0000
Resent-Message-ID: <handler.58175.B58175.166490248814597 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: martin rudalics <rudalics@HIDDEN>
Cc: 58175 <at> debbugs.gnu.org, monnier@HIDDEN, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166490248814597
          (code B ref 58175); Tue, 04 Oct 2022 16:55:01 +0000
Received: (at 58175) by debbugs.gnu.org; 4 Oct 2022 16:54:48 +0000
Received: from localhost ([127.0.0.1]:55065 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oflBv-0003nN-Vh
	for submit <at> debbugs.gnu.org; Tue, 04 Oct 2022 12:54:48 -0400
Received: from eggs.gnu.org ([209.51.188.92]:55772)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oflBs-0003n8-Vi
 for 58175 <at> debbugs.gnu.org; Tue, 04 Oct 2022 12:54:46 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:59322)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oflBl-0008MU-Ti; Tue, 04 Oct 2022 12:54:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=+pltLGCRCI6uUG+ijL6xlrctWtzDWwh7RLdzYwwW6wU=; b=sCLaoK4rEQU3
 W1FL5BUwK6E2YDag3qyOObnujjqhJZlG7ozlMsMgSMDy8+gv7FKOzqY9dPaP4eMHhrw3vUl/f5uqQ
 Tc/3BQN1HiujbowhkJdvxlrgnfaNsd1nXb5Kyd+9u9fx7+PfJPmUABIsKNSWLTPU7rRp6SRva0db4
 llEYBmEnnaHTSmLTP4EB0epF4Fo7lY0o3A0H7z6jckJt6UbH9qe4Jwd+eM21q8C7E5JeTxVw+5eJ/
 KBKEyAWme19GO30DJ9OaG/hN+Ai/khmc3E/n+tG7zONwuaVj5I1TggCOklmc3FFSSQJ++O02sHiDF
 kqw12cMv/G+18fWuz6+ohQ==;
Received: from [87.69.77.57] (port=1449 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oflBk-000085-SX; Tue, 04 Oct 2022 12:54:37 -0400
Date: Tue, 04 Oct 2022 19:54:32 +0300
Message-Id: <83bkqrv8af.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN> (message from
 martin rudalics on Tue, 4 Oct 2022 10:23:49 +0200)
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN> <83fsg6186y.fsf@HIDDEN>
 <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 4 Oct 2022 10:23:49 +0200
> Cc: 58175 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
> From: martin rudalics <rudalics@HIDDEN>
> 
>  > Looks like the internal-region-overlay window parameter, which is
>  > important for correct workings of region-highlight, isn't copied
>  > correctly to the other window as part of swapping state, because its
>  > value ends up as "overlay N in no buffer", i.e. the overlay's buffer
>  > is lost in transition.
> 
> If you want a window parameter to get copied when swapping window states,
> you have to explicitly mark it as "persistent".  For example with:
> 
> (push '(internal-region-overlay . t) window-persistent-parameters)

Thanks.  Does this affect only window-swap-states, or does this affect
anything else?  If the former, I guess the above should be done
globally when Emacs is dumped?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 04 Oct 2022 20:28:02 +0000
Resent-Message-ID: <handler.58175.B58175.166491525019646 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: martin rudalics <rudalics@HIDDEN>, 58175 <at> debbugs.gnu.org, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166491525019646
          (code B ref 58175); Tue, 04 Oct 2022 20:28:02 +0000
Received: (at 58175) by debbugs.gnu.org; 4 Oct 2022 20:27:30 +0000
Received: from localhost ([127.0.0.1]:55307 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ofoVm-00056m-5D
	for submit <at> debbugs.gnu.org; Tue, 04 Oct 2022 16:27:30 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:41263)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1ofoVi-00056X-Sm
 for 58175 <at> debbugs.gnu.org; Tue, 04 Oct 2022 16:27:28 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 32DEA4431B1;
 Tue,  4 Oct 2022 16:27:20 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 83EFF4431A7;
 Tue,  4 Oct 2022 16:27:14 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1664915234;
 bh=glvBnOpYMnChE3JqBwIPPVqPIe+8R5VSwUFa7zg2tPg=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=SLkADgGGIkFfAq0ev+851aOPiWJ5dEcYZy+e4SnK+MIbPsrmMbQj/2/NmAq75ElpG
 L0iRPE0DD3JD6QeVWfKqrGXJZRPRW52puLgCf8SZGpJa7O+aEwmShLa3j/39T5DtvM
 4GSDD8cod0AgJ7CREe1um8LT+8RU1uiKA9l3N65Z6o4dTh1RyRaUdEa9BeDtMBWM2l
 cvoZ2UWQiYJttfddytAdKG+Fvb5Reg3CpPOGbkzos74nibsZP40CpBDUjyB8q5ujoy
 Hv+DU58MEtyLoyfR4byD/jV629mvXLPdxh9oDjkBkpGn+7ua0ilz/r4dRDQ/Ie/Z0f
 az7B+i2yP0cmQ==
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 69593120206;
 Tue,  4 Oct 2022 16:27:14 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <83bkqrv8af.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 04 Oct
 2022 19:54:32 +0300")
Message-ID: <jwv4jwjqr8g.fsf-monnier+emacs@HIDDEN>
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN>
 <83fsg6186y.fsf@HIDDEN> <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN>
 <83bkqrv8af.fsf@HIDDEN>
Date: Tue, 04 Oct 2022 16:27:13 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.019 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>>  > Looks like the internal-region-overlay window parameter, which is
>>  > important for correct workings of region-highlight, isn't copied
>>  > correctly to the other window as part of swapping state, because its
>>  > value ends up as "overlay N in no buffer", i.e. the overlay's buffer
>>  > is lost in transition.
>> 
>> If you want a window parameter to get copied when swapping window states,
>> you have to explicitly mark it as "persistent".  For example with:
>> 
>> (push '(internal-region-overlay . t) window-persistent-parameters)

Hmm... I must say I misunderstood the report when I read it originally.
Now that I see a bit more clearly what it's about I wonder why we'd have
to do something special (w.r.t `internal-region-overlay`) for
`window-swap-states` compared to what we do (i.e. nothing at all) when
we do `set-window-buffer`.

More specifically, AFAICT the code that uses `internal-region-overlay`
just tries to reuse that info to try and reduce memory churn, but it
should work correctly even when `internal-region-overlay` points to the
wrong buffer or even if it's not an overlay at all.

IOW, I suspect the bug is in `redisplay-(un)highlight-region-function`
and adding `internal-region-overlay` to `window-persistent-parameters`
would likely just cover it for that use-case but it could
reoccur elsewhere.


        Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 04 Oct 2022 21:05:01 +0000
Resent-Message-ID: <handler.58175.B58175.166491745231561 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: martin rudalics <rudalics@HIDDEN>, 58175 <at> debbugs.gnu.org, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166491745231561
          (code B ref 58175); Tue, 04 Oct 2022 21:05:01 +0000
Received: (at 58175) by debbugs.gnu.org; 4 Oct 2022 21:04:12 +0000
Received: from localhost ([127.0.0.1]:55337 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ofp5H-0008Cy-Ql
	for submit <at> debbugs.gnu.org; Tue, 04 Oct 2022 17:04:12 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:61526)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1ofp5C-0008CQ-HZ
 for 58175 <at> debbugs.gnu.org; Tue, 04 Oct 2022 17:04:10 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id B054D807CB;
 Tue,  4 Oct 2022 17:04:00 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 4850D80394;
 Tue,  4 Oct 2022 17:03:59 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1664917439;
 bh=1CmWV2UhJioev4Akfisd4vxWtfuBcucxlug5VYYuDfQ=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=U0RMt44oRw8MdVQV1ojNY4oxQkf5iy37yGOZFhnUg6OoqsS2DrIox7F+EgDL9K6b6
 7xSlvq7Gu5vHVgeUimcPJ6PnZzSOgWCwKfwDixDeXmLcrG6kx0XaGLgOFdZAHolAyz
 piGsRGhcguuyUDKd7d0rZ+OSSovlo+BOZaFo8f5TPUBL4yNfTigkZer42u9sGoWA0j
 y5PZB+8JzrHmgU/InIhGF5x5nkuriTHk08iCIgwQ2cYvNSzK1YQ9FQ5qFyH4FCT4N7
 4scTiTv9fcjaDsc26Cs/JF0XWmz6mPP2tlOYtOsc4AC1KfERcb8NKG63vIfpykb4Tl
 Vgoqj6hOZMXgQ==
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 368BB1203F3;
 Tue,  4 Oct 2022 17:03:59 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwv4jwjqr8g.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 04 Oct 2022 16:27:13 -0400")
Message-ID: <jwvy1tvpam8.fsf-monnier+emacs@HIDDEN>
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN>
 <83fsg6186y.fsf@HIDDEN> <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN>
 <83bkqrv8af.fsf@HIDDEN> <jwv4jwjqr8g.fsf-monnier+emacs@HIDDEN>
Date: Tue, 04 Oct 2022 17:03:58 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.179 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> IOW, I suspect the bug is in `redisplay-(un)highlight-region-function`
> and adding `internal-region-overlay` to `window-persistent-parameters`
> would likely just cover it for that use-case but it could
> reoccur elsewhere.

Hmm... then again not.  Still thinking about it.


        Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 04 Oct 2022 21:26:02 +0000
Resent-Message-ID: <handler.58175.B58175.16649187261007 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: martin rudalics <rudalics@HIDDEN>, 58175 <at> debbugs.gnu.org, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.16649187261007
          (code B ref 58175); Tue, 04 Oct 2022 21:26:02 +0000
Received: (at 58175) by debbugs.gnu.org; 4 Oct 2022 21:25:26 +0000
Received: from localhost ([127.0.0.1]:55344 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ofpPp-0000GB-Q7
	for submit <at> debbugs.gnu.org; Tue, 04 Oct 2022 17:25:26 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:4376)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1ofpPl-0000Fv-BM
 for 58175 <at> debbugs.gnu.org; Tue, 04 Oct 2022 17:25:24 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id F318B80394;
 Tue,  4 Oct 2022 17:25:15 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3B68C800AE;
 Tue,  4 Oct 2022 17:25:14 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1664918714;
 bh=qBzAFVPEEE71hW1dmSoALY1x+Izz/Jtr2nxe/swFx4Q=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=UVYUTohMvY1k0sOzx6D6qcGLTFjFyBEI6GaACYdJ2wqDWx6AQrxZOlosuPeuCmWhO
 c2M1fFzqiV4OLzn1WJbUbNCQxrWhWq/RiK2ZnVaTG6+d66QTYkNDlksrsCNW4ywUn4
 QTB8qWLA+n2Bjk9NtF2alWkXVc4ka7bM41vfan7/yviyPdN9ARgLk/2WkX86W1QmBH
 m9HHN0FrI86qdmgQHzDQSQWFspWHAzImbvfK12vFD3PfIowTdBj1ZRvFLa340cwhbQ
 WMNtVGmrimWfuufzu7gHJWSiMTbv6F3jtcpuSzT/5hSx4t8RHmXy/jkij1lkGIU/V0
 tIRIzmQ8gTu4Q==
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 17C4F120EB0;
 Tue,  4 Oct 2022 17:25:14 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwvy1tvpam8.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 04 Oct 2022 17:03:58 -0400")
Message-ID: <jwvsfk3pa14.fsf-monnier+emacs@HIDDEN>
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN>
 <83fsg6186y.fsf@HIDDEN> <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN>
 <83bkqrv8af.fsf@HIDDEN> <jwv4jwjqr8g.fsf-monnier+emacs@HIDDEN>
 <jwvy1tvpam8.fsf-monnier+emacs@HIDDEN>
Date: Tue, 04 Oct 2022 17:25:13 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.179 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> IOW, I suspect the bug is in `redisplay-(un)highlight-region-function`
>> and adding `internal-region-overlay` to `window-persistent-parameters`
>> would likely just cover it for that use-case but it could
>> reoccur elsewhere.
> Hmm... then again not.  Still thinking about it.

I guess it boils down to whether it's OK for a function like
`window--state-put-2` to "unilaterally" set window parameters to nil as
it does in:

      ;; Reset window's parameters and assign saved ones (we might want
      ;; a `remove-window-parameters' function here).
      (dolist (parameter (window-parameters window))
	(set-window-parameter window (car parameter) nil))

I don't think it's right to add `internal-region-overlay` to
`window-persistent-parameters` since we don't want/need to store those
overlays in window-state objects.

We could change the above code so it only sets to nil those
parameters that are listed in `window-persistent-parameters`, but I'm
not sure if that's the right choice.  It might be, tho: it seems odd to
just zap properties owned by arbitrary packages without giving them
a chance to "say goodbye".

Or we could add some kind of hook (similar to a `change-major-mode-hook`
but for window state changes rather than major mode changes) so code
like the region-highlight code can register itself there to throw away
its overlays before a new window-state is installed.

Or we need to change the `redisplay--(un)highlight-overlay-function`s so
as to keep their overlays (and similar info) elsewhere, probably in
a variable rather than a window-parameter since window-parameters can
disappear without warning.


        Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 05 Oct 2022 05:43:01 +0000
Resent-Message-ID: <handler.58175.B58175.166494855024686 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Monnier <monnier@HIDDEN>
Cc: rudalics@HIDDEN, 58175 <at> debbugs.gnu.org, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166494855024686
          (code B ref 58175); Wed, 05 Oct 2022 05:43:01 +0000
Received: (at 58175) by debbugs.gnu.org; 5 Oct 2022 05:42:30 +0000
Received: from localhost ([127.0.0.1]:55655 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ofxAs-0006Q6-3f
	for submit <at> debbugs.gnu.org; Wed, 05 Oct 2022 01:42:30 -0400
Received: from eggs.gnu.org ([209.51.188.92]:36786)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1ofxAq-0006Pt-LV
 for 58175 <at> debbugs.gnu.org; Wed, 05 Oct 2022 01:42:29 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:40006)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1ofxAj-0008Qk-BK; Wed, 05 Oct 2022 01:42:21 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Hf9wOUrh6vvFffIUZ8D4HlBy9GmwtPGSeUtMRGJDPws=; b=WBrW/KNQCL1L
 6Jfh4pKaOswspVaETFlCc3x+bVednMtOV815dWuTUcd4AIuO+SAVrrZtJM3az170ckab8eZTuF5Np
 ZI4jC0sIfg+V+PFEPwKgTdIz+pVF+ZE5xJB9x1rm7deM2F6btuD0xTJlDzzQOxYFSfd2qtVqFJEAO
 tgKpLH7nvdOOweeewkVE/YKw9Rt8WeDLTus7EJC1XMDI+fWimLDbm0qxnu0DEGkjs6QQ9MEJdLv0i
 YJuYTrGShcim+xT4JV+KYdZHb8mf0eIXlibSeWyxXs6hUsdb7VaMgSa/+j+nDlbWQPpRA0eMF/Iyx
 JeoeWGX2yHLlrN6oUxkBnA==;
Received: from [87.69.77.57] (port=1395 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1ofxAi-0003h3-MZ; Wed, 05 Oct 2022 01:42:21 -0400
Date: Wed, 05 Oct 2022 08:42:17 +0300
Message-Id: <83wn9eu8qu.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <jwvsfk3pa14.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Tue, 04 Oct 2022 17:25:13 -0400)
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN>
 <83fsg6186y.fsf@HIDDEN> <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN>
 <83bkqrv8af.fsf@HIDDEN> <jwv4jwjqr8g.fsf-monnier+emacs@HIDDEN>
 <jwvy1tvpam8.fsf-monnier+emacs@HIDDEN>
 <jwvsfk3pa14.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -0.3 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> From: Stefan Monnier <monnier@HIDDEN>
> Cc: martin rudalics <rudalics@HIDDEN>,  58175 <at> debbugs.gnu.org,
>   miha@HIDDEN
> Date: Tue, 04 Oct 2022 17:25:13 -0400
> 
>       ;; Reset window's parameters and assign saved ones (we might want
>       ;; a `remove-window-parameters' function here).
>       (dolist (parameter (window-parameters window))
> 	(set-window-parameter window (car parameter) nil))
> 
> I don't think it's right to add `internal-region-overlay` to
> `window-persistent-parameters` since we don't want/need to store those
> overlays in window-state objects.
> 
> We could change the above code so it only sets to nil those
> parameters that are listed in `window-persistent-parameters`, but I'm
> not sure if that's the right choice.  It might be, tho: it seems odd to
> just zap properties owned by arbitrary packages without giving them
> a chance to "say goodbye".

Martin will tell, but I'm pretty sure this wasn't born out of thin
air.  I'm sure there are window parameters that will do harm if
copied.  Look at the list of window parameters in the "Window
Parameters" node of the ELisp manual, and try to convince yourself
that you want to copy all of them by default (we currently only copy
clone-of, AFAIU).

> Or we could add some kind of hook (similar to a `change-major-mode-hook`
> but for window state changes rather than major mode changes) so code
> like the region-highlight code can register itself there to throw away
> its overlays before a new window-state is installed.

Why is this cleaner than maintaining a list of "persistent"
parameters?

> Or we need to change the `redisplay--(un)highlight-overlay-function`s so
> as to keep their overlays (and similar info) elsewhere, probably in
> a variable rather than a window-parameter since window-parameters can
> disappear without warning.

Maybe.  But why complicate a mechanism that is already extremely
complicated and hard to understand for a bystander, and needed several
fixes until we got it right?  The use case in this bug report is
pretty marginal, so much so that from where I stand we could
legitimately say "this is not supported".  It hardly warrants making
questionable changes in mechanisms that are so central to routine
Emacs operation.

Btw, if we do want to consider changes in the region-overlay
machinery, then how about having
redisplay--unhighlight-overlay-function clean up by deleting overlays
whose buffer is nil or dead?  That would at least avoid leaving around
"stale" overlays that were once the region, which is what happens in
this case.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: martin rudalics <rudalics@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 05 Oct 2022 07:37:01 +0000
Resent-Message-ID: <handler.58175.B58175.16649554163392 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 58175 <at> debbugs.gnu.org, monnier@HIDDEN, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.16649554163392
          (code B ref 58175); Wed, 05 Oct 2022 07:37:01 +0000
Received: (at 58175) by debbugs.gnu.org; 5 Oct 2022 07:36:56 +0000
Received: from localhost ([127.0.0.1]:55785 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ofyxb-0000sd-JJ
	for submit <at> debbugs.gnu.org; Wed, 05 Oct 2022 03:36:55 -0400
Received: from mout.gmx.net ([212.227.17.20]:46727)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1ofyxZ-0000sN-4W
 for 58175 <at> debbugs.gnu.org; Wed, 05 Oct 2022 03:36:54 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1664955403;
 bh=7ducdzYF0e4UoIBANhpJURoiUrnwYULEwC1Ei0MWiks=;
 h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To;
 b=NiQErfS6qO03LUePiZhYtW/Ax9lJNKKkUSlWgGxvBquFK7MebwN+JYsFAcw3kz2k3
 zXA/SXju4pMPh2hQuexyZ4tpDrtFwfyuo2ppbOYfSH2XrFoXFvxRnp/+n/aS45r/U7
 ctlqdeAszszvmLI+fqM5P+wAl4/0tw99ns+MIHgg=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.100] ([213.142.97.113]) by mail.gmx.net (mrgmx104
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MryXN-1p0gne0AZJ-00nuef; Wed, 05
 Oct 2022 09:36:43 +0200
Message-ID: <4b64c2c5-4613-c690-d32d-ce21e36faba0@HIDDEN>
Date: Wed, 5 Oct 2022 09:36:40 +0200
MIME-Version: 1.0
Content-Language: en-US
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN> <83fsg6186y.fsf@HIDDEN>
 <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN> <83bkqrv8af.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
In-Reply-To: <83bkqrv8af.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:9G4oQ7VtltD63K4d0RAnlaIGuaydTTcvnnnDmQeie7uWp+Hl1g5
 kPXWrbKI/s8ko1ubx+nppylpQCplH+SZBDL/wmlWd4MOsBSQgYEfG6PP7Dvv++jotrslT7A
 NWxfCqKlqa1oP7+GBjnS2dK2UwR02VxuZ5ppYgSzJZH7SgX7D2fBS49ppCJaNpf2kY6eQ28
 a1zoG6U1rAziwYID+ehfA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:/2SOpUyai5I=:O6LsU83NVh5ckBEIRdeddB
 pdBnot1T0PNKP2uNGoCR5M97pNgyeljZHKmxZaDWoF3RERMGtnbsBK5a0ECPcyrAAxVKXubbH
 1om+mef3Nxo1YRCqZhXtaoniBA5sOabxHt9s2sFKy+EGUc2B9th/wsJxHbGqUlH3qW8xsZVlk
 QJ8oAprTHUm/gMUvuIQkTv7hhHp5dJVAf4J4VZSpdoAzV1U4leW6Ha8BSBXeWvK5COnbvvaFX
 kEsRqiRb8j5IKEyaUL1d7vzZnNY00ocnkE1ZXW958lEhJmhyTm/hkSO1kx+VNCFTXbB3LcuJ8
 ivhxQZb+dwGSW7WQ8BWjnRF6NSxD8urT7fyo2y4CfWz6HAzblnDMbI/OKtTANFpLu2QYXIoHb
 w5hJvCTkOIkDZHQsGFcTRHrX4/wBsRyokrbOqDhCskXIw/UdJ8TgNCGpH/U+6utsp+fsp3SAd
 UPmGdZMtZUe4yvNhYb+3jDvQfyrGhTgrEgJBzTWlIn+M8XeO59awAjkoTO9mVSy40zTcbnv9n
 6Dr9G4ZvzJiHogIntvkDO8LAhUusRZDFqreg9VnZ1gOP0zSTVYXFiNT3dnAkgSwzNI21pF86G
 DtqPSEFEmK/LpZ9eJDD7wcA7TBFSc7IO8qf1CpVNhMSUGNnk9RQnbRHaYkI92LBRcZSJxIdeE
 l6QRZWKLbIqUg4xqo7fSmKBq+JzAsv7mG74COYCi1FghMSXRbcCBpXUXXMm28+m4nirvb3aBL
 u5CzLGZ2bf9EK4ezmI+M7psD8VnOA7RpThj3LyYP2wI3gsOfAKFfL4xboZttigmpYXFsZWLx6
 w8pM6u7jFx4Ji3lO8nCKREOJJz/9vrA2Kz8yHrgJGyi5CaT8KguPuqeDczWH2uNdfF/LcSo6F
 InOESyOoUqHfWBKeocBWLK7v6uoaDzYblqLX3450tssk4uqmjXfPpM0TbppXJqzE5Rn7laZ9D
 tUw24S20Pd2kmMaPRum3hQ1YuQ0EgM0Er0RnVyekBzhdxt9YbQg7MOORPJDBHGT2Dr/ymGZH7
 7cRC5NOzAuiFqxxH7girItmZDIGNpbyAERDj6tg2v1E+/JyRhScOOHTfD/YaP8E9gEjlBfRTQ
 TL17n1PAmHmCL6zRzDwJqrVwz6tN4vFy7G2MJx8PWDmi7y+QI0s39R8OWN6irsiNRnm/m79OS
 7/x+GTFVn5WGlpGbRBzRQoLhCu
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

 >> (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




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 05 Oct 2022 08:29:02 +0000
Resent-Message-ID: <handler.58175.B58175.16649585258299 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: martin rudalics <rudalics@HIDDEN>
Cc: 58175 <at> debbugs.gnu.org, monnier@HIDDEN, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.16649585258299
          (code B ref 58175); Wed, 05 Oct 2022 08:29:02 +0000
Received: (at 58175) by debbugs.gnu.org; 5 Oct 2022 08:28:45 +0000
Received: from localhost ([127.0.0.1]:55818 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ofzlk-00029n-Vg
	for submit <at> debbugs.gnu.org; Wed, 05 Oct 2022 04:28:45 -0400
Received: from eggs.gnu.org ([209.51.188.92]:36222)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1ofzlh-00029a-T0
 for 58175 <at> debbugs.gnu.org; Wed, 05 Oct 2022 04:28:43 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:48246)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1ofzla-0001Df-PP; Wed, 05 Oct 2022 04:28:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=JWJ0qFjxy+LJ2GCp5DpyxpNEAKGIrIyEtuPqTwp4dR8=; b=ODuSBSY04KM3
 PiFSE8Zlad2R86I27sAlI/MGlt3uGlrh+DTONkqlLoHM0SOzz4j1rlpIMDxav/+pL7iyLd2nDfQyi
 rYOeBx6DxFuf4CJ6KxYlhbFz0S54prvKtzGSUI3nRL9Ynqt31xFcnMvB4BGdToDHleH+8WhmE4frM
 +2FwuS2sR/CXAvpY7rsaDWG6tdGiv7+/AgiRAcvvNhbnwF4IjJrIGd3Nsq1jo9BxhVAzQ9QWEKFWw
 wNXeqtFVdIZ5clqwcFCy9BOcVdb9VNJ2nsJ0vhdQnYqHQjiqKXWnKcCR9uN87TljYIVXCRxY9+niD
 gsXmCZT0hCN450adhGAoDw==;
Received: from [87.69.77.57] (port=4342 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1ofzlZ-0003ib-U1; Wed, 05 Oct 2022 04:28:34 -0400
Date: Wed, 05 Oct 2022 11:28:30 +0300
Message-Id: <83k05eu11t.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <4b64c2c5-4613-c690-d32d-ce21e36faba0@HIDDEN> (message from
 martin rudalics on Wed, 5 Oct 2022 09:36:40 +0200)
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN> <83fsg6186y.fsf@HIDDEN>
 <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN> <83bkqrv8af.fsf@HIDDEN>
 <4b64c2c5-4613-c690-d32d-ce21e36faba0@HIDDEN>
X-Spam-Score: -0.3 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> Date: Wed, 5 Oct 2022 09:36:40 +0200
> Cc: miha@HIDDEN, 58175 <at> debbugs.gnu.org, monnier@HIDDEN
> From: martin rudalics <rudalics@HIDDEN>
> 
> 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.

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.

>  > 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.

So you are saying we should redesign how region overlay is implemented
and managed?  I'd prefer not to go there.

> 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.

highlight-nonselected-windows, I guess?  How can we have a single
global overlay and still support that option?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: martin rudalics <rudalics@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 06 Oct 2022 07:49:01 +0000
Resent-Message-ID: <handler.58175.B58175.166504250729833 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 58175 <at> debbugs.gnu.org, monnier@HIDDEN, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166504250729833
          (code B ref 58175); Thu, 06 Oct 2022 07:49:01 +0000
Received: (at 58175) by debbugs.gnu.org; 6 Oct 2022 07:48:27 +0000
Received: from localhost ([127.0.0.1]:58762 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ogLcI-0007l5-VZ
	for submit <at> debbugs.gnu.org; Thu, 06 Oct 2022 03:48:27 -0400
Received: from mout.gmx.net ([212.227.15.18]:37601)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1ogLcG-0007ks-QR
 for 58175 <at> debbugs.gnu.org; Thu, 06 Oct 2022 03:48:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1665042494;
 bh=8/uXx/JA5savYjmwQgPAeTPeW0pswPqRayzYGMNYEb4=;
 h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To;
 b=eXrOc12qrJIudZsADcSZMRDvoDS2tLLhB0drNyjOkVS+HHIRthM+fcD9ImqqetKiu
 MCzinSzPP9+NK4I1fZEmu8eED01OKk2QURz+cNt2FSiC7CB5ytepPNRQOXSFteHvUQ
 L0UnOMqKdY8fnYwNTgWVFXl4BCplBtBNyFIFjFEQ=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.100] ([212.95.5.112]) by mail.gmx.net (mrgmx005
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N5VHM-1pHAjk30fa-016xWc; Thu, 06
 Oct 2022 09:48:14 +0200
Message-ID: <48874213-cfe4-dc07-fe0a-cb085d6549ef@HIDDEN>
Date: Thu, 6 Oct 2022 09:48:12 +0200
MIME-Version: 1.0
Content-Language: en-US
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN> <83fsg6186y.fsf@HIDDEN>
 <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN> <83bkqrv8af.fsf@HIDDEN>
 <4b64c2c5-4613-c690-d32d-ce21e36faba0@HIDDEN> <83k05eu11t.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
In-Reply-To: <83k05eu11t.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:B4vH3MhZv8tARnLBfdG2rcoiCQx7rH0wPhVPlwPcyyLlTLYjxPv
 +443cbL2M5nn/c11472w16c2K8kBMw6CKEwnQC2TH7s0HbBge8mGby8cvCtTPec6TZTQwbo
 V8sd6lwEvN8I1yUSK+gGMop9WS53T0f+f6uVip4h6T9WaMwynpqdgYoP6xQZVuOa9T51Jn1
 8ViuAAsnP40r0Ny50UNCA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:lGDiW08skIQ=:xd3tSfdgW8se58tQ5n25+u
 qVjLn27y8Fvd2MJp8mv02LJni8PCPvsoYMtCcHeAPYuIGljSE9Z/RK7JqdfYyR65wt9Oe5QL5
 maBEWVwoJa93vPm3mx/R36ySjWhFd1T56Avs8/LgLoOpl1nhwrd3A7OD4M81fmk7mavA3pTIN
 7O/XJdK41gyecV5t1q+XmZWwSxboMPX5RVNs6+I1ZkoKOtnL4ugsnMFJLwDT9iqgOoIaCtpH9
 OqvqkXMtSszTzuTEPrSxuglH2dSvzcmRI3qsPxLP1ECDk0mNitwCtdLmxIr1xEzZQ22+e/Sw+
 R2ZSkviSPfzisoXEmEvpOhq70GtA6v+yEWaEhERdXpo3TeR4oovwjvnwQM0Dsm187GdeWsFpq
 1hLrb8nrSdS+ibGS7XZPEV55WDwBgyJ+O9w83gbk5JqJEAfjFl1K3f9Jd9IZudyYGrUC5fcS5
 s4KTZzKqTcgwyb/xNXrdJGnEghoYx79sBNIz6W7RjbzwSARaCrgLH3kwoaeJRRJdP7ApnSZOY
 42siPEFzwMJ9HBsCioIAXRV/7gAXIGJiMhWI0NIGAN7USGVpGv1cd7AEvQ6McwnXAKZDD8pCV
 iO15Weaxx7qO02TvaCD8p5UWr7qO9kWa41J7oTgBi+ap6RTMAtFYop7qxrYpdqQ10ZQYrPlcD
 CxYZ54FMK+8R8YW3j/Th/1L5nyHGg4YgUTtipaUrsFDMFcu3V/mX3Sr6lbrSx+wnMh7o6bNyx
 mJcJLueJR5IouzGpWikjjU59n9aaVo7D4yK0RbnLSX4uhS1oqyrXf8RisIrIHgwTNR8dZI1Z4
 imgQJ79zmd/4JRqALRFa++ivOXL92TxkZean/jL2w3FPYW2CwpMPSQGuuKN0ZqlhXXX1FXcPX
 ioRN9YrIKZsmW8o+OnrkyKZW2OsubUQWxrPnv/ElWc1xzdBjAjzvu1rg2yOAR8o/c758S1E5b
 C3k0jJpJ3cKmPKpBHyTm28EgX8I6F3U0vYNNwp2RNkgKTfsA2A8dafmSEnpHyF9ss4Y9KszRK
 aMrw9mKxWNr31GoGMPPZIs3m4TAG2+aqf3axz7p0lhhYKxg/w2E44pwp5ApY1RugfHZ+MHq2N
 GFUG4DRokGx6/JIvKJQdOGkDwTAbLL3ub4WS3Wf8wqQGYzy+Kr7Mw4GwP11F+JzQYvpEGqoIi
 lCgrpiFeYSN49BeVvOy8bRAv1Fu/JB/PEYonVfH5FE34YxVxTTZ3/u8/RdRcXRnFQ9zh+YQ0Q
 daaLvqAxIfC2Bv5i3uijVN7N+xDzi/+x5r8uKaMZBiv2/FrFAxpXNphjWe6tx5dIfPv1iAoca
 GrPchUTRxFMa+TpzbC01HuszDYvJs9dF6WVv5vl3n/amiANl5rsz7VnSyMmpuxg5iibEkA/7z
 h5eYWICs/XcbaraRrmnJDMzURcV50JMstT1PL5jtUKr+mDM+LDj2mTrdJkVGG/6Ar7eb9m3nK
 S01+/ycF1+0lfmzuKbwlfUbdlNIOTfUfa936qjm+8S5v9R6s6UycKPhjtxpa/utgrfhm6zTlw
 ib56kT+b8YeK60s+vUSDq/LjuU/yLhhnW8amyHSQph4AC
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

 > 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




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 06 Oct 2022 08:14:02 +0000
Resent-Message-ID: <handler.58175.B58175.166504399732317 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: martin rudalics <rudalics@HIDDEN>
Cc: 58175 <at> debbugs.gnu.org, monnier@HIDDEN, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166504399732317
          (code B ref 58175); Thu, 06 Oct 2022 08:14:02 +0000
Received: (at 58175) by debbugs.gnu.org; 6 Oct 2022 08:13:17 +0000
Received: from localhost ([127.0.0.1]:58825 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ogM0L-0008PB-5x
	for submit <at> debbugs.gnu.org; Thu, 06 Oct 2022 04:13:17 -0400
Received: from eggs.gnu.org ([209.51.188.92]:43130)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1ogM0J-0008Oy-DS
 for 58175 <at> debbugs.gnu.org; Thu, 06 Oct 2022 04:13:15 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:49770)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1ogM0D-0002rK-6k; Thu, 06 Oct 2022 04:13:09 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=M2tmkfBJfjkq9B3PTrqvkFDRjMievzgq79vJGBZS5XM=; b=rQ4KMgQ3suF+
 gCjN9kDHV3AQw3sE+XvoxLqUs5k9ZeAbQKF2XXZjFwbXlDER60q7lvkP1DP+mMp9b4d3lzwGfd19X
 qCjZiHDAxWbJ0K7vMNcBD7KdH1flHvy6cDA9vOFiaUbzqhajj+qse5+hxXvLp9BB6i0p98v4y2fSl
 kAXivEgrh68GpRG009QY+vrg+YX5KdQQqUSN1q33eP78blRN3ULSsPUgvLunUhbID1ZCwYyN+y/Vp
 YNkq9xHO1HhK8rdcaAUsuGFMCPqwN8M/cPdobP1KjN0z/gLGwK9DMNgxpBNFxWmMp6Fz24VGufu7U
 jmd/oC0eTJqSoNGV3Z03+Q==;
Received: from [87.69.77.57] (port=4646 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1ogM06-00017C-Vm; Thu, 06 Oct 2022 04:13:08 -0400
Date: Thu, 06 Oct 2022 11:13:03 +0300
Message-Id: <83a669qsj4.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <48874213-cfe4-dc07-fe0a-cb085d6549ef@HIDDEN> (message from
 martin rudalics on Thu, 6 Oct 2022 09:48:12 +0200)
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN> <83fsg6186y.fsf@HIDDEN>
 <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN> <83bkqrv8af.fsf@HIDDEN>
 <4b64c2c5-4613-c690-d32d-ce21e36faba0@HIDDEN> <83k05eu11t.fsf@HIDDEN>
 <48874213-cfe4-dc07-fe0a-cb085d6549ef@HIDDEN>
X-Spam-Score: -0.3 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> Date: Thu, 6 Oct 2022 09:48:12 +0200
> Cc: miha@HIDDEN, 58175 <at> debbugs.gnu.org, monnier@HIDDEN
> From: martin rudalics <rudalics@HIDDEN>
> 
> 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.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 06 Oct 2022 12:26:02 +0000
Resent-Message-ID: <handler.58175.B58175.166505913127705 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: rudalics@HIDDEN, 58175 <at> debbugs.gnu.org, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166505913127705
          (code B ref 58175); Thu, 06 Oct 2022 12:26:02 +0000
Received: (at 58175) by debbugs.gnu.org; 6 Oct 2022 12:25:31 +0000
Received: from localhost ([127.0.0.1]:59282 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ogPwQ-0007Cn-EI
	for submit <at> debbugs.gnu.org; Thu, 06 Oct 2022 08:25:31 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10829)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1ogPwN-0007CY-I5
 for 58175 <at> debbugs.gnu.org; Thu, 06 Oct 2022 08:25:28 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 24F6A443491;
 Thu,  6 Oct 2022 08:25:22 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6718744347A;
 Thu,  6 Oct 2022 08:25:20 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1665059120;
 bh=fac3WJpHcRT7qCEVWiavlagUDAdBwG8LWYJt7WT2GjI=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=M8uBcY0uUb9XhRZzuF+zHELfgBpQEIUx5DDiOgK3KjdYmzHmDsjo7Lupr0QN2nonN
 s3ImRkP+SWNE1lQwXG3E15KXvUBodSLG7wMc71zvmkoDAmlEc4A+2DEck3DyPbY+6q
 N1GZuiDbdEX+d/PJKX4G48wDnoM51SioCrJf7kAnV+6/D2+mvgaWD//rMKI4uNg24C
 W5YZUDNbclBWW/qP7HY47/kdTiC8hytSMPqxB0tqk1Mk5/8nLjbf59okO7mKk0akYW
 pJ69xN0vOAeLX8LNhhp5A9pUfS6qrlyceir90MOrYL7kAMVPqY4UBPmTvk135w0cnr
 8P02R6jsQAgYw==
Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3073F120744;
 Thu,  6 Oct 2022 08:25:20 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <83wn9eu8qu.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 05 Oct
 2022 08:42:17 +0300")
Message-ID: <jwvtu4h40hs.fsf-monnier+emacs@HIDDEN>
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN>
 <83fsg6186y.fsf@HIDDEN> <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN>
 <83bkqrv8af.fsf@HIDDEN> <jwv4jwjqr8g.fsf-monnier+emacs@HIDDEN>
 <jwvy1tvpam8.fsf-monnier+emacs@HIDDEN>
 <jwvsfk3pa14.fsf-monnier+emacs@HIDDEN> <83wn9eu8qu.fsf@HIDDEN>
Date: Thu, 06 Oct 2022 08:25:19 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.019 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> We could change the above code so it only sets to nil those
>> parameters that are listed in `window-persistent-parameters`, but I'm
>> not sure if that's the right choice.  It might be, tho: it seems odd to
>> just zap properties owned by arbitrary packages without giving them
>> a chance to "say goodbye".
>
> Martin will tell, but I'm pretty sure this wasn't born out of thin
> air.

Could be, but the behavior is not documented, AFAICT: the doc seems to
suggest that `window-state-put` doesn't touch the parameters that are
not mentioned in `window-persistent-parameters` (whereas it actually
throws them out unconditionally).

> I'm sure there are window parameters that will do harm if
> copied.

I'm not talking about copying.  I'm talking about leaving them where
they are.

>> Or we could add some kind of hook (similar to a `change-major-mode-hook`
>> but for window state changes rather than major mode changes) so code
>> like the region-highlight code can register itself there to throw away
>> its overlays before a new window-state is installed.
> Why is this cleaner than maintaining a list of "persistent"
> parameters?

Notice there are two notions of "persistent" here.

Let's say we use `window-stat-save` in window A and then
`window-state-put` in window B:

- `window-persistent-parameters` lets you control which parameters of
  window A are "persisted/copied" to B.  `internal-region-overlay`
  doesn't want to be among those copied parameters.

- I'm suggesting we add some way to control what happens to parameters
  that were in window B.  Clearly, for those parameters in
  `window-persistent-parameters` they'll have to be overwritten.
  But currently they are all wiped out unconditionally just before
  putting the new state, which is a problem in the case of
  `internal-region-overlay` where we don't necessarily need to preserve
  its value (tho that would work as well), but we'd need to remove it
  a bit more carefully at least.

I see `window-state-put` as something similar to calling a major-mode:
it starts by "killing all local variables" (i.e. removing all window
parameters) and then sets up its own state.

I see 3 options:

- Change `window-state-put` so it doesn't touch those parameters not
  mentioned in `window-persistent-parameters`.  This is arguably the
  simplest change and IMO it would make it behave closer to what its
  doc suggests.

- Add a `before-clearing-window-parameters-hook`, just like
  `kill-all-local-variables` runs the `change-major-mode-hook` (tho, if
  so, we should design it such that it's a bit easier for that hook
  to make some parameters survive unscathed).

- Add a new variable (or some new special value for
  `window-persistent-parameters`) listing those window parameters that
  should not be touched by `window-state-put` (i.e. the equivalent of
  "persistent variables").


        Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: martin rudalics <rudalics@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 07 Oct 2022 08:10:01 +0000
Resent-Message-ID: <handler.58175.B58175.166513016822728 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 58175 <at> debbugs.gnu.org, monnier@HIDDEN, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166513016822728
          (code B ref 58175); Fri, 07 Oct 2022 08:10:01 +0000
Received: (at 58175) by debbugs.gnu.org; 7 Oct 2022 08:09:28 +0000
Received: from localhost ([127.0.0.1]:34254 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ogiQC-0005uW-AR
	for submit <at> debbugs.gnu.org; Fri, 07 Oct 2022 04:09:28 -0400
Received: from mout.gmx.net ([212.227.15.15]:33113)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1ogiQ7-0005uG-7h
 for 58175 <at> debbugs.gnu.org; Fri, 07 Oct 2022 04:09:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1665130153;
 bh=mdyBM45b1yLxhKY7InpdyPpkkLQ4B4sEr+Jy9i/QsIk=;
 h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To;
 b=hTQEMFPB+FroMdN7njAJD+g/9YrtgUvya6IcxrH2E6HPMQ573aBUPeNL8GTzpzwQM
 ppUFxP2rJ/e9bb7i8jX0Nfo2UNZO+ghJc6bmcm1UrPc5+VgKo7ezyraV9bDEkZ/xwN
 c4PyTGCqatbpTYZeJ418a1VM6VrGReyU0RvOXIdU=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.100] ([213.142.97.66]) by mail.gmx.net (mrgmx005
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MlNpH-1p3QJA1GtZ-00ljVg; Fri, 07
 Oct 2022 10:09:13 +0200
Message-ID: <0216030f-94a5-35fb-b70c-503acd83a507@HIDDEN>
Date: Fri, 7 Oct 2022 10:09:11 +0200
MIME-Version: 1.0
Content-Language: en-US
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN> <83fsg6186y.fsf@HIDDEN>
 <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN> <83bkqrv8af.fsf@HIDDEN>
 <4b64c2c5-4613-c690-d32d-ce21e36faba0@HIDDEN> <83k05eu11t.fsf@HIDDEN>
 <48874213-cfe4-dc07-fe0a-cb085d6549ef@HIDDEN> <83a669qsj4.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
In-Reply-To: <83a669qsj4.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:9RSb+ckCsdBTde3IGJIBePN1Z48y4Pe+tZ98m3iibQ8TVDecygi
 5C2INMbtY3PB7/+mlBXSC2e02w7zJooflGGUrrBKkdqKzXj9zSrmMT8DpKYaeqMURBMAUyj
 3ndnW7yt4tF6in6M4WKRpk//qTTWSXE96/B3gneBSk5WhElqY8Y3E6nBZVJ5e6hgzyDXG/H
 gCRBWviVP4KASFuPcNMsQ==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:z8mirhCLywY=:ZU7FeXjO9YL66dHiWZpixj
 YErCmG6Jgo+bGIxbvTL/0pBT+zTVbukdXyNzULCKQ9gFDZrCieMyMH2KOFgvkn4OKxE724Noo
 eO2EivFlcJRL/hHkO/KB/wouJnoSl+3UCDsIAC3YhZrEqHU+zBhBc4gcqvV9cUnoOtGjW5+Bn
 gq77AZQHoMKjHERu8JT2PXHLisX0CQx9AKEXRs41ZtLsfSSEOwBkngVrZtWv7ZsDYQ/N/WRa8
 /rumaVz0S0ifzJBqSq1ukLeGES9rHx5eEiGPVNYtiL7d4OsjUUD6rbpyGm8fwRFthFqigZw/D
 LmDRpn/j/W4TC4uGCavooHZDowEJIY7r1Kk8L4ChNlH9tTwtVkfpdz8LBLd3CSQeDT0iclEmT
 kkvT7Fa7WmkYDMOlh07fvVufc0sFv8f6ZpdPxHqzB4T4sfaiCmv85YpbvW1ysv3l/jbqb/tZ/
 QyYxSC2fHkO/cPyRZVFjFJUeQmP3VTRRS2v3WiQkOH3KCMBa/r/YvzEBgrsioOL85t4dkyLgY
 2q55kMrvOoMFWwKo6Hl+LWufc8H3EHgzuS8WmFu3myYSnE030oZpR+ZFC3v3ETkpYuYQE41Nw
 jcMjS3MImUHjmYCuNDTnceaNKnOhTOmTD11koZsmoptqyX0kyRJEW1A+uS3xRBdeQYfoleaDy
 OiS0pCe3hgqNqO0bItrrkMG8ZhO1/k5/lelykPMnf5mRozgmYqGXvy37TVslnMkkWg8Bjx7Fe
 gEEXDs8hdSkTUFcwIQGhqBsn7yNBQ/jb3F8NKn/mTvG3iFCqE33k6mvHlDNn53Mq2Sv7hZAtw
 lOio2gH1LIGgQLi9JxXswNnTFT3EA3jC8x7PteRv0tkydiyhO88RsonLD/NACphZlugifzdPK
 2SRzjzqofee5cPoGhUKF1OBqiCYZ8y7ca1R+SnxfIUj0ZUCDQ9lYdWiX+xJVACZVPNB9chQts
 a4wITDTzWvA6sqZaV+CQuSB1daCm+/xZQzjXcfQb43HLO9SrsSdvfkgHjU24yS06DsOslxh1L
 0WWoC1+cI4y9YZEeWxiqEXifmO3WqnYxctuKsymtss8/AEZ3hvhnNC0T92aq+42J5qXZkFiek
 xHpHp4oEDXbUJENhMxzsknkPOlMXxDNUxsXERyuIBPvvQMg5OESUeCxwhoR4/13dGPq8xctRG
 flvOE4jP/tyobgyS5McdjGJFZq4waxTjAD9TRNVY2uCxIU9ZriBxSA9ivgBma8U3uE7Wa77ny
 DoqHvx1y792R0T19/FuOyxu2qYWc6ASbKF9myEhOk5v1LfAXKxIpv44yOPyYBU79LBSosnWfY
 MoLJGA29UpkKmvMX7MuMXaqcL/kIxQacQ9GzZavgatqhNnAphJFM06qo0Nt4mX8eRWTh/Ge9U
 w6VgWhry4l/u9XOaDsI6ssYiVZDhzudl6v6eh09rIj2Eomy9Pm/bdRdJk+hgcsyT80cKx/C8P
 y1O56x7AcKXsc0Z5uGCol6wJ6UGNX0HUPpLKweXwFw+QgJYIWeIOqIeESu34FS3wlU8ZwVAb0
 DOAMdCFmYTHiv+iYKoDmLvLChBWZudOHWhUDdv3NLae5Z
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

 > Both results in this scenario are wrong, IMO, so I don't see why we'd
 > prefer one of them.

The one with the persistent overlay leaves behind an overlay in the
lower window that is not removed by the region highlighting code.  So
that gets us back another incarnation of the original bug.

 > I also don't understand how this scenario could
 > happen in real life, FWIW.

Given the plethora of 'set-window-configuration' and
'save-window-excursion' calls in the Emacs code base (some of them with
separate position handling instructions), I'm quite confident that it
eventually will happen.

martin




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: martin rudalics <rudalics@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 07 Oct 2022 08:18:02 +0000
Resent-Message-ID: <handler.58175.B58175.166513066623510 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Monnier <monnier@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
Cc: 58175 <at> debbugs.gnu.org, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166513066623510
          (code B ref 58175); Fri, 07 Oct 2022 08:18:02 +0000
Received: (at 58175) by debbugs.gnu.org; 7 Oct 2022 08:17:46 +0000
Received: from localhost ([127.0.0.1]:34266 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ogiYD-000677-VL
	for submit <at> debbugs.gnu.org; Fri, 07 Oct 2022 04:17:46 -0400
Received: from mout.gmx.net ([212.227.15.18]:44203)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1ogiY8-00066p-DC
 for 58175 <at> debbugs.gnu.org; Fri, 07 Oct 2022 04:17:44 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1665130650;
 bh=X3Hfu2Wk3zsskrj3VSuJzlS40zTNH2MBqywSbgFNKuc=;
 h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To;
 b=igjLJO6z5PthUjUZaXJtH3EYufXl8u+Idn216UaMDzP/gdBj1qXkE9hHi9BY6hJWT
 b5RZJbLW1IwU/f1foIMyAXOrjS7D7TRoWUpekVC8tdoHnRxg98Ntz6cMouK6/D+tsF
 cS3ajaP/uIgtOeQzeJl+Fnwn5fqB9yS1niuER+mw=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.100] ([213.142.97.66]) by mail.gmx.net (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M2wGs-1odQl33u9M-003MHc; Fri, 07
 Oct 2022 10:17:30 +0200
Message-ID: <53e1c03a-25da-c772-1801-8c8cb8ee0df3@HIDDEN>
Date: Fri, 7 Oct 2022 10:17:27 +0200
MIME-Version: 1.0
Content-Language: en-US
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN> <83fsg6186y.fsf@HIDDEN>
 <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN> <83bkqrv8af.fsf@HIDDEN>
 <jwv4jwjqr8g.fsf-monnier+emacs@HIDDEN>
 <jwvy1tvpam8.fsf-monnier+emacs@HIDDEN>
 <jwvsfk3pa14.fsf-monnier+emacs@HIDDEN> <83wn9eu8qu.fsf@HIDDEN>
 <jwvtu4h40hs.fsf-monnier+emacs@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
In-Reply-To: <jwvtu4h40hs.fsf-monnier+emacs@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64
X-Provags-ID: V03:K1:jq7v28tL0Hbo+6n0u0Nmg8cMQn9VzXpsPL4og2SRAS15Qe5Ysqo
 aW0ozbfi2PzYnyi6lyaaDsPf1RCpWn3ko3ocVj6ShDP3Jmzuf4Un2Uv08fWaOdfOLIRpRmD
 O79ISy6ngtto9HpbF12B0S06QoZScr2Nch/PT02l0S8IP7gKJo8zMDTHTpbjtcagqjg04Da
 4HhqtL6VE7wlM01R769HA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:o0bJvVKh6uI=:nClM2oDePMkV7stoupp9m6
 qKKHUMU7oL0X1zngxouKzwUBx+utzfQjdQqRF3IGX56xMUBY3pM8vU1uCfKQPWCbB9gO53gbL
 aWgBg4XPmOk/QYzUIy4q7J8ftggG7PtNhaBlh9hO7srHxpj5/7l7lrWWS8XxiQ0Y5pm6Gubfe
 W52lSLDQhUk8y+36D35wNdPsAXOsugDL9ktIAJz8y0Pu2i0muDXwvIEKDdU8/7CITkCvWWUXV
 wp+PHhpYJ3dmJdYbwWOsF+EI4+Bwo0SUCNYfor1uNECMMduS1tDZkwDJRVE/yCvR5dhp2hdJm
 yO7ZcdEWhd7xaaExPlhoLH+/WtqT80Wqbn1+toHfhaB1mjWJlhdAayfBd61uuzDJgY216DoaE
 vQGf/wUwsQIxZFIo+ahfhn81mSJ2GgHKs0EGJPViNHfwtkETFZ3SH3eJ7cyGlBdkxvh0Kf4/F
 fTbkQvI6aC6xIvCDFnD0ku54UYr6l7rJOJuzJoLngpXt7oIL0iO8fU0w4dc3xiywb9fW7/Ek0
 L/KjKSWTsp92kLe8wI2aoCQkPw7aCK1R4P8xVGwHA+ebvhaYh3UpHGaOc8jqRd8H5zy8dZQWu
 b/7dF6Yl2fOoXEOGoKIaPqKHfxH2BtTTS3QjSjhHjkcTcklJ/5UyEncNl6negus5SMtFjX01B
 kJDKrKP78VXtd0k4u+56KGbUUdS3VIQI06SkyLp/oLZgU0i1Y3wYtmTjF1KjgDSSk+eSgWN7u
 PjHJPjcqGwc4Su0GI/7owotcPLApMWYAUIHHNAAZTtSy4E11nKMmAC8sgHr6mPCqawVq8U65t
 WnQK4KEVYRvxDuRNMfSVvDwuPNwb/8RxC8wTl367gt2/d0ezt1ZlG90aTJMocfVtlN02/Pm4G
 ouXUCLo+BPeFPR6Nf0s1Il6PgjyPuM2MsrFsJgKpy2GusTKXXc+3UxcGcsTI3VfAXWp2PyYuM
 BEsCOIRQ1ol4BT9bEaO1PJ8+jDNHQ+ngs7NrWsCI2l+7FKhhw6ABuHq3MPH5lVkA75VOnX3L5
 aow0nmssYdNfNWV4mckXhu/i0xTTv0VzXhsFe+FfHCL1FrMgZT+aJE32L5KVGnr6zSMPCAQFC
 3O/Oa/J8ALUQV1qeNEUlm9Y5Vkd3FyKUrHmg0yk8eMfAoi0D1Vorgn/58oZ69VT54jBT8yXe6
 iAyQL7vKW5+9bjwPou5sWDR1xOutZjpMnt0oDQUOnsgOrU4rAItOFMaRECcDkkwhyLFlXCJl0
 H53230KcZW36pZatDUbukEbRxBqJO4DJQlUb5WRJldCQxMmWiWa3LMt/MTr3iSMtyV8/7OLLQ
 xexsWCJUqUoevn6qbSVducx+a3JcTAAs5KY8VLDXS+ODwceLQH9LAkaO2sn8vkbSnvEC6g93T
 MTz3Ts7NJKz7K8Xff3Cg3TiswP7raVclpj7NmGujxq1P1k3rPr2pUIi94zamtIJ5o71EZ5m3p
 J0KOdsgw8NpGrP74c2tLYiAXvqSArJuFJnULp8C2HL5/7Jiyrg880SMmkaL5UJhBj/KUOYQvu
 27mYiaQrNO5R6pCmZSImlQxz4+TfoD8HpNJjxlXSuM0s/
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

ID4gQ291bGQgYmUsIGJ1dCB0aGUgYmVoYXZpb3IgaXMgbm90IGRvY3VtZW50ZWQsIEFGQUlD
VDogdGhlIGRvYyBzZWVtcyB0bw0KID4gc3VnZ2VzdCB0aGF0IGB3aW5kb3ctc3RhdGUtcHV0
YCBkb2Vzbid0IHRvdWNoIHRoZSBwYXJhbWV0ZXJzIHRoYXQgYXJlDQogPiBub3QgbWVudGlv
bmVkIGluIGB3aW5kb3ctcGVyc2lzdGVudC1wYXJhbWV0ZXJzYCAod2hlcmVhcyBpdCBhY3R1
YWxseQ0KID4gdGhyb3dzIHRoZW0gb3V0IHVuY29uZGl0aW9uYWxseSkuDQoNCkFGQUlDVCB0
aGF0J3MgY29uc2lzdGVudCB3aXRoIHRoZSByZW1haW5pbmcgYmVoYXZpb3Igb2YgdGhlc2Ug
ZnVuY3Rpb25zLg0KVGhlIHZhbHVlcyBvZiB0aGUgd2luZG93IHdoZXJlIHRoZSBzdGF0ZSBp
cyBwdXQgYXJlIGNvbXBsZXRlbHkgcmVwbGFjZWQNCmJ5IHRoZSB2YWx1ZXMgb2YgdGhlIHdp
bmRvdyB3aGVyZSB0aGUgc3RhdGUgaGFzIGJlZW4gb2J0YWluZWQgZnJvbS4NCg0KID4gSSBz
ZWUgMyBvcHRpb25zOg0KDQpJJ20gc3RpbGwgbm90IGNvbnZpbmNlZCB0aGF0IHdpbmRvdyBw
YXJhbWV0ZXJzIGFyZSB0aGUgYmVzdCBjaG9pY2UgZm9yDQprZWVwaW5nIGluZm9ybWF0aW9u
IGFib3V0IHRoZSBoaWdobGlnaHRlZCByZWdpb24uICBJIHRoaW5rIHRoZXkgc2hvdWxkDQpi
ZSB1c2VkIG9ubHkgZm9yIHRoaW5ncyB0aGF0IGRvIG5vdCBkZXBlbmQgb24gdGhlIGJ1ZmZl
ciBzaG93biBpbiB0aGF0DQp3aW5kb3cgb3Igb24gc29tZSBnbG9iYWwgdmFyaWFibGUuDQoN
ClRoZSBwYXJhbWV0ZXIgdXNlZCBoZXJlIGlzIGEgY29uZ2xvbWVyYXRlIC0gJ3dpbmRvdy1w
b2ludCcgaXMgd2luZG93DQpsb2NhbCwgdGhlIG1hcmsgaXMgYnVmZmVyIGxvY2FsIGFuZCB3
aGljaCB3aW5kb3cgaXMgdGhlIHNlbGVjdGVkIG9uZSBpcw0KZ2xvYmFsLiAgQnV0IHNpbmNl
LCBhcyBFbGkgc2FpZCwgd2UgYWxzbyBtYXkgd2FudCB0byBoaWdobGlnaHQgdGhlDQpyZWdp
b24gaW4gbm9uLXNlbGVjdGVkIHdpbmRvd3MsIHRoZXJlIG1pZ2h0IGJlIG5vIGJldHRlciBj
aG9pY2UuICBJbg0KZWl0aGVyIGNhc2UsIHBsZWFzZSBrZWVwIGluIG1pbmQgdGhhdCB0aGUg
cGVyc2lzdGVuY2Ugb2YgcGFyYW1ldGVycyBtdXN0DQpiZSBhbHNvIGhhbmRsZWQgYnkg4oCY
c2V0LXdpbmRvdy1jb25maWd1cmF0aW9u4oCZIHRob3VnaCB0aGF0IG9uZSBuZXZlciBoYXMN
CnRvIHRyYW5zZmVyIHByb3BlcnRpZXMgZnJvbSBvbmUgd2luZG93IHRvIGFub3RoZXIuDQoN
Cm1hcnRpbg0K




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 07 Oct 2022 19:30:02 +0000
Resent-Message-ID: <handler.58175.B58175.166517094913907 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 58175
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: martin rudalics <rudalics@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 58175 <at> debbugs.gnu.org, miha@HIDDEN
Received: via spool by 58175-submit <at> debbugs.gnu.org id=B58175.166517094913907
          (code B ref 58175); Fri, 07 Oct 2022 19:30:02 +0000
Received: (at 58175) by debbugs.gnu.org; 7 Oct 2022 19:29:09 +0000
Received: from localhost ([127.0.0.1]:37411 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ogt1x-0003cA-29
	for submit <at> debbugs.gnu.org; Fri, 07 Oct 2022 15:29:09 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:47807)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1ogt1v-0003bq-Nl
 for 58175 <at> debbugs.gnu.org; Fri, 07 Oct 2022 15:29:08 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4A7F8100845;
 Fri,  7 Oct 2022 15:29:02 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 30FEB1000F3;
 Fri,  7 Oct 2022 15:29:00 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1665170940;
 bh=D5md3p1eVaq8FJ4FZ7ZZk/Vvv0bLgOcfUSyrvoIUg0M=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Xh7Aj2wPOrWLAU2vMmO5XWrJ8gRXm0YgN5/CDEFRLofvBvg+bzNQnnzMlkxug1hd9
 czWXpEvhJ5P3218IiNe6iKh1T4UzqD7ifU7FvUOhb1F6mf9XCzNmCl19o+7pJ6y3CX
 ZSVbUVOHkpxFB8cUd0f4xZRzMNX6fTdfwlxv7YJsBM6jX4mE1RjTWrNxFyu/QBeeJy
 a8IAbsemGxvj/gOrah0QGiI/MEiAFCS2AHPHfjTiFpY9AoQLIfvy5ZX+uhfJCcRHTB
 1kyRz/8UGcn4kJ61ZWByiUnMFyvgt0q4YXLOkm/aIjLZSXI9lOjlThjwXwiJOP6vUJ
 RXPY4wBWLvGjQ==
Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id ECF75120E98;
 Fri,  7 Oct 2022 15:28:59 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <53e1c03a-25da-c772-1801-8c8cb8ee0df3@HIDDEN> (martin rudalics's
 message of "Fri, 7 Oct 2022 10:17:27 +0200")
Message-ID: <jwva6675u5v.fsf-monnier+emacs@HIDDEN>
References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@HIDDEN>
 <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@HIDDEN>
 <83fsg6186y.fsf@HIDDEN> <a7948abf-9643-3856-fbfc-4c63961da2ad@HIDDEN>
 <83bkqrv8af.fsf@HIDDEN> <jwv4jwjqr8g.fsf-monnier+emacs@HIDDEN>
 <jwvy1tvpam8.fsf-monnier+emacs@HIDDEN>
 <jwvsfk3pa14.fsf-monnier+emacs@HIDDEN> <83wn9eu8qu.fsf@HIDDEN>
 <jwvtu4h40hs.fsf-monnier+emacs@HIDDEN>
 <53e1c03a-25da-c772-1801-8c8cb8ee0df3@HIDDEN>
Date: Fri, 07 Oct 2022 15:28:56 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.063 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> Could be, but the behavior is not documented, AFAICT: the doc seems to
>> suggest that `window-state-put` doesn't touch the parameters that are
>> not mentioned in `window-persistent-parameters` (whereas it actually
>> throws them out unconditionally).
> AFAICT that's consistent with the remaining behavior of these functions.

Could you clarify what you mean by that?
Which other functions and what "remaining behavior" are you thinking of?

> The values of the window where the state is put are completely replaced
> by the values of the window where the state has been obtained from.

That's indeed the behavior of the code, as I pointed it out, but the
docstring of `window-persistent-parameters` says:

    Parameters not saved by =E2=80=98current-window-configuration=E2=80=99 =
or
    =E2=80=98window-state-get=E2=80=99 are left alone by =E2=80=98set-windo=
w-configuration=E2=80=99
    respectively are not installed by =E2=80=98window-state-put=E2=80=99.

"not installed" is not the same as "thrown away".

If we want to keep this behavior, we should document it a bit more
clearly, I think.  Maybe that's what you meant by the distinction
between "left alone" and "not installed"?

Also, I think it's worthwhile then to add some hook run before throwing
away that info.

>> I see 3 options:
> I'm still not convinced that window parameters are the best choice for
> keeping information about the highlighted region.

You might be right, but that's a somewhat orthogonal discussion.
I don't think this choice should be imposed by a specific choice of
behavior of `window-state-put`.

> The parameter used here is a conglomerate - 'window-point' is window
> local, the mark is buffer local and which window is the selected one is
> global.  But since, as Eli said, we also may want to highlight the
> region in non-selected windows, there might be no better choice.

Yes, I think we'll have to use a hash-table (weakly) indexed by windows :-(

> In either case, please keep in mind that the persistence of parameters
> must be also handled by =E2=80=98set-window-configuration=E2=80=99 though=
 that one
> never has to transfer properties from one window to another.

AFAIK the current code works fine with `set-window-configuration`.
And indeed `set-window-configuration` behaves the way I suggest
`window-state-put` should behave:

	  /* Restore any window parameters that have been saved.
	     Parameters that have not been saved are left alone.  */


-- Stefan






Last modified: Fri, 7 Oct 2022 19:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.