From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#33871: 27.0.50; Revert Dired window saved in window configuration Date: Thu, 17 Feb 2022 11:05:56 +0100 Message-ID: <1830e7af-27a8-ac7f-ba6f-fa2006139208@gmx.at> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26098"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 33871@debbugs.gnu.org, Lars Ingebrigtsen To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 17 11:17:52 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 1nKdrD-0006fK-5U for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Feb 2022 11:17:51 +0100 Original-Received: from localhost ([::1]:40646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKdrB-0005V0-U7 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Feb 2022 05:17:49 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKdgk-0000Us-Mv for bug-gnu-emacs@gnu.org; Thu, 17 Feb 2022 05:07:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKdgk-0000sM-D5 for bug-gnu-emacs@gnu.org; Thu, 17 Feb 2022 05:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nKdgk-0002hp-9P for bug-gnu-emacs@gnu.org; Thu, 17 Feb 2022 05:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Feb 2022 10:07:02 +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.164509236710314 (code B ref 33871); Thu, 17 Feb 2022 10:07:02 +0000 Original-Received: (at 33871) by debbugs.gnu.org; 17 Feb 2022 10:06:07 +0000 Original-Received: from localhost ([127.0.0.1]:50210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKdfr-0002gI-AK for submit@debbugs.gnu.org; Thu, 17 Feb 2022 05:06:07 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:53643) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKdfp-0002fn-3X for 33871@debbugs.gnu.org; Thu, 17 Feb 2022 05:06:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1645092358; bh=2oJBv9JX9cprdscp80hcmFJoE7vWWkjFfFFKW05pANU=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=AbfeQqZMIviLCY28Ir331IhaDFbVDrH3Daht1lOFHcHAahv4KUvYSm5jA+hzWuhd8 5El16LuewIbmE82GUoGYM8FliSbu94CEcLr9DLcXPG4wIq4vLYkQ63u/nh7vLGihQt QZNWbn0TuHaag6dK07ikjKon1/7e/aCknHoXRMvw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.101] ([213.142.96.55]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MXXyJ-1nlw0P0oNb-00YvFY; Thu, 17 Feb 2022 11:05:58 +0100 Content-Language: en-US In-Reply-To: <86sfsi29yc.fsf@mail.linkov.net> X-Provags-ID: V03:K1:hRgxKdYGonuWLOeiHzzPBluYobKNZz19I4ZsnqcnzR6CjiK92wY FkxPuh6vDe9ThdX1lVwyEGZHLtHGcsDVhLdJjfT4g6EhfWv3S+C0H7D3kbqYYA6gHoVwlzB 0tjEyH5r+w9LPaMPQ12fcA9w7hnm1WHJ3sHMLxCqTRlyL0poT2HpIHKOea3H90cl6AoCA66 lggnvMFPJmq5YiFupe8MA== X-UI-Out-Filterresults: notjunk:1;V03:K0:kB719ISav2o=:HYD9LKnK/lPh0RivuKa71l sGyQ6BHsGh8HwRQz9NILmEJ5zi1JKQPFX44409XibuIgcpdO5UVcopcwp3O7QDdGtOkXx3Ssd 34j6MS67ODqptdj244LWlPGBYLSh8kBas+pUEIeVdzO3PLB9bOg36mDMzuoKdbtGjuj7SXq86 x66D101sJeZFCqacYKdOc8+z1iQq6VpMtdAlea9RHqyNZy0PmXd4kw1ytfuInScHtQXNCmKaY EGArt/KY0rQM/ql85DrTarvWt0vlw98Cy97bFWisCv+RCBaDnXb38KcVvERZZ08mGuo+ig09H sm5nXJgV7648I5sq6W6UnqXv4eXrYtfcH6NmLhkE98hQdmX3QLh9RuyJ5Nkf2r+62tOYp0INO +dJ/6vNr3CmzyZfA9SfJh7DuOOdY1oASRwdTteM0EkzsXWKEo194JxlM7oMI3BH/WxPLzRAL2 TvaF2IkabnHOtb7Hph8HKCXPu7z6Xb3u/n1nHpGUp2oH4h7SQiS8HnQNtKs9vH7kICWts2IQx naKrqEGFQ/W7iy29afiBkhXGw4OFtMIAwYLYgL5ld8zG6s8KlwLueld7bKxp2nblcxmWCFISv qtkEh8IOhmc3PCHiSb64TsQKIlcqxTFlF9mm6YMpZ1krgYr8447Erw+LKSnz3YpGti1jZ3LRc pTdacPf7/ewUkH/Ov2potG1Qd1jhq16Emz59iQ50qJSe3gCAhcvCjCyf3sy/8cIG4YU2a3Ppf UDmhcwRKRWTDV/FNDA7AUM32XRoTmNIJjHVaCZB0cGmbC+fEbFY/+IgF6ZlenodPPbEEYd4C 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:227079 Archived-At: > Instead of (goto-char p-m), after (set-window-configuration w-c) > something like this should be performed: > > (dired-goto-file (car (cdr (assoc (current-buffer) > (window-parameter nil 'dired-positions))))) Once more: Your scenario is (progn (dired "/tmp") (dired-next-line 1) (split-window) (other-window 1) (dired "/tmp") (dired-next-line 2) (let ((w-c (current-window-configuration)) (p-m (point-marker))) (view-emacs-todo) (delete-other-windows) (with-current-buffer (get-buffer "tmp") (revert-buffer)) (set-window-configuration w-c) (goto-char p-m))) But this cannot work with dired buffers because they are reverted in a special way that does not care about 'window-point' and the like. This means that the value of 'point-marker' you saved in p-m has become just meaningless after the 'revert-buffer' call. Basically, this is a hard problem we'll probably never be able to solve satisfactorily. We could handle 'window-point' separately when saving and restoring window configurations and the window's buffer is a dired buffer. For example, 'dired-revert' could call a function 'window-revert-timestamp' to store the current time of the revert operation for this window and 'current-window-configuration' (and 'window-state-get') would store their current time stamp in the configuration (or state). Then 'set-window-configuration' (and 'window-state-put') could check whether a window's revert time stamp is larger than the time stamp stored in the configuration and not set point for that window when the revert time stamp is later. Is it worth the hassle? martin