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: Fri, 07 Oct 2022 15:28:56 -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> <83wn9eu8qu.fsf@gnu.org> <53e1c03a-25da-c772-1801-8c8cb8ee0df3@gmx.at> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25671"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Eli Zaretskii , 58175@debbugs.gnu.org, miha@kamnitnik.top To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 07 21:30:14 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 1ogt30-0006T4-Aj for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Oct 2022 21:30:14 +0200 Original-Received: from localhost ([::1]:49010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogt2y-0000XD-U0 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Oct 2022 15:30:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogt2p-0000Wg-Hc for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2022 15:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38333) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogt2p-0000Ys-7Z for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2022 15:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ogt2o-0003df-Mg for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2022 15:30: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: Fri, 07 Oct 2022 19:30: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.166517094913907 (code B ref 58175); Fri, 07 Oct 2022 19:30:02 +0000 Original-Received: (at 58175) by debbugs.gnu.org; 7 Oct 2022 19:29:09 +0000 Original-Received: from localhost ([127.0.0.1]:37411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogt1x-0003cA-29 for submit@debbugs.gnu.org; Fri, 07 Oct 2022 15:29:09 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:47807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogt1v-0003bq-Nl for 58175@debbugs.gnu.org; Fri, 07 Oct 2022 15:29:08 -0400 Original-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) Original-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== Original-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) In-Reply-To: <53e1c03a-25da-c772-1801-8c8cb8ee0df3@gmx.at> (martin rudalics's message of "Fri, 7 Oct 2022 10:17:27 +0200") 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:244843 Archived-At: >> 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