From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#33871: 27.0.50; Revert Dired window saved in window configuration Date: Tue, 22 Feb 2022 19:14:27 +0200 Organization: LINKOV.NET Message-ID: <86fsoaq4lo.fsf@mail.linkov.net> References: <87bm59mglk.fsf@mail.linkov.net> <87fsoo323s.fsf@gnus.org> <86h792x3wv.fsf@mail.linkov.net> <119a9c2c-e27f-6c3a-07ad-66bc76fc58cf@gmx.at> <861r05co9l.fsf@mail.linkov.net> <86zgmsne32.fsf@mail.linkov.net> <86sfsi29yc.fsf@mail.linkov.net> <1830e7af-27a8-ac7f-ba6f-fa2006139208@gmx.at> <86fsohmqn9.fsf@mail.linkov.net> <9df28298-fedc-0cfe-7243-c04868115e90@gmx.at> <86fsoezsw3.fsf@mail.linkov.net> <86sfsewvxr.fsf@mail.linkov.net> <9d741b43-e3bb-669b-b345-6b877c902b33@gmx.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13787"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 33871@debbugs.gnu.org, Lars Ingebrigtsen To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 22 18:30:05 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 1nMYzE-0003PM-Cm for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Feb 2022 18:30:04 +0100 Original-Received: from localhost ([::1]:36012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMYzC-0004UB-GJ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Feb 2022 12:30:02 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMYyE-0003cD-B7 for bug-gnu-emacs@gnu.org; Tue, 22 Feb 2022 12:29:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48650) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMYyE-0000Tr-1m for bug-gnu-emacs@gnu.org; Tue, 22 Feb 2022 12:29:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nMYyD-0003vA-VK for bug-gnu-emacs@gnu.org; Tue, 22 Feb 2022 12:29:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Feb 2022 17:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33871 X-GNU-PR-Package: emacs Original-Received: via spool by 33871-submit@debbugs.gnu.org id=B33871.164555088314994 (code B ref 33871); Tue, 22 Feb 2022 17:29:01 +0000 Original-Received: (at 33871) by debbugs.gnu.org; 22 Feb 2022 17:28:03 +0000 Original-Received: from localhost ([127.0.0.1]:42545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMYxG-0003tb-N7 for submit@debbugs.gnu.org; Tue, 22 Feb 2022 12:28:03 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:64369) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMYxD-0003sV-7e for 33871@debbugs.gnu.org; Tue, 22 Feb 2022 12:27:59 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id DB15940009; Tue, 22 Feb 2022 17:27:50 +0000 (UTC) In-Reply-To: <9d741b43-e3bb-669b-b345-6b877c902b33@gmx.at> (martin rudalics's message of "Mon, 21 Feb 2022 10:07:15 +0100") 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:227452 Archived-At: >>> How would 'save-window-excursion' handle the case of a dired buffer that >>> gets reverted while its FORMS are run? >> >> 'dired-goto-file' will restore dired-positions after 'save-window-excursion'. > > Who calculated those dired-positions and who calls 'dired-goto-file' to > restore them? Like in bug#54038 (about having access to windows in window configurations), the problem is that there is no way to update and even peek inside a window configuration. In bug#54038 the cleanup function can't tell if a window is still live in a window configuration. And here 'dired-revert' can't update windows saved in a window configuration. 'dired-save-positions' goes to great lengths to employ get-buffer-window-list, and walk-windows with window-prev-buffers to update the Dired buffer even in window-prev-buffers. And 'dired-restore-positions' with the same number of lines tries to restore all prev-buffers. But still 'dired-revert' fails to update the Dired buffer in window configurations saved in tabs, or in winner.el, or in 'C-x r w' (window-configuration-to-register), etc. A possible solution would be to add two hooks: 1. hook before finishing 'current-window-configuration' that will add all windows to some variable that the cleanup function could check in bug#54038. This is like 'dired-save-positions'. 2. hook after calling 'set-window-configuration' that will restore previous positions. This is like 'dired-restore-positions' that uses 'dired-goto-file'.