From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii 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: Wed, 05 Oct 2022 08:42:17 +0300 Message-ID: <83wn9eu8qu.fsf@gnu.org> 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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35238"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rudalics@gmx.at, 58175@debbugs.gnu.org, miha@kamnitnik.top To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 05 07:43: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 1ofxBb-000906-VK for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Oct 2022 07:43:16 +0200 Original-Received: from localhost ([::1]:38238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofxBZ-0004bW-TN for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Oct 2022 01:43:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofxBO-0004b0-W5 for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 01:43:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofxBO-0008TG-47 for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 01:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ofxBN-0006RQ-WD for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 01:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Oct 2022 05:43:01 +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.166494855024686 (code B ref 58175); Wed, 05 Oct 2022 05:43:01 +0000 Original-Received: (at 58175) by debbugs.gnu.org; 5 Oct 2022 05:42:30 +0000 Original-Received: from localhost ([127.0.0.1]:55655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofxAs-0006Q6-3f for submit@debbugs.gnu.org; Wed, 05 Oct 2022 01:42:30 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofxAq-0006Pt-LV for 58175@debbugs.gnu.org; Wed, 05 Oct 2022 01:42:29 -0400 Original-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 ) 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==; Original-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 ) id 1ofxAi-0003h3-MZ; Wed, 05 Oct 2022 01:42:21 -0400 In-Reply-To: (message from Stefan Monnier on Tue, 04 Oct 2022 17:25:13 -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:244486 Archived-At: > From: Stefan Monnier > Cc: martin rudalics , 58175@debbugs.gnu.org, > miha@kamnitnik.top > 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.