From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay Date: Tue, 04 Oct 2022 17:25:13 -0400 Message-ID: References: <86sfkaay2d.fsf@miha-pc> <83a66if2r0.fsf@gnu.org> <8735cauh0b.fsf@miha-pc> <837d1mf0op.fsf@gnu.org> <83fsg6186y.fsf@gnu.org> <83bkqrv8af.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17805"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: martin rudalics , 58175@debbugs.gnu.org, miha@kamnitnik.top To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 04 23:51:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ofpoq-0004Sw-55 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Oct 2022 23:51:16 +0200 Original-Received: from localhost ([::1]:37148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofpod-0000lp-Vb for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Oct 2022 17:51:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofpQR-0005X9-0H for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2022 17:26:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56266) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofpQQ-0004UN-Of for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2022 17:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ofpQQ-0000Gz-Bv for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2022 17:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Oct 2022 21:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58175 X-GNU-PR-Package: emacs Original-Received: via spool by 58175-submit@debbugs.gnu.org id=B58175.16649187261007 (code B ref 58175); Tue, 04 Oct 2022 21:26:02 +0000 Original-Received: (at 58175) by debbugs.gnu.org; 4 Oct 2022 21:25:26 +0000 Original-Received: from localhost ([127.0.0.1]:55344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofpPp-0000GB-Q7 for submit@debbugs.gnu.org; Tue, 04 Oct 2022 17:25:26 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:4376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofpPl-0000Fv-BM for 58175@debbugs.gnu.org; Tue, 04 Oct 2022 17:25:24 -0400 Original-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) Original-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== Original-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) In-Reply-To: (Stefan Monnier's message of "Tue, 04 Oct 2022 17:03:58 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:244478 Archived-At: >> 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