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 16:27: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="16733"; 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 22:54:55 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 1ofowJ-0004AE-Hn for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Oct 2022 22:54:55 +0200 Original-Received: from localhost ([::1]:35212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofowI-0000kV-CO for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Oct 2022 16:54:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofoWI-0007vH-T4 for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2022 16:28:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56229) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofoWI-0006GT-JZ for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2022 16:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ofoWI-00057d-2R for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2022 16:28: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 20:28: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.166491525019646 (code B ref 58175); Tue, 04 Oct 2022 20:28:02 +0000 Original-Received: (at 58175) by debbugs.gnu.org; 4 Oct 2022 20:27:30 +0000 Original-Received: from localhost ([127.0.0.1]:55307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofoVm-00056m-5D for submit@debbugs.gnu.org; Tue, 04 Oct 2022 16:27:30 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:41263) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofoVi-00056X-Sm for 58175@debbugs.gnu.org; Tue, 04 Oct 2022 16:27:28 -0400 Original-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) Original-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== Original-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) In-Reply-To: <83bkqrv8af.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 04 Oct 2022 19:54:32 +0300") 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:244476 Archived-At: >> > 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