GNU bug report logs - #33871
27.0.50; Revert Dired window saved in window configuration

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Tue, 25 Dec 2018 21:43:01 UTC

Severity: minor

Found in version 27.0.50

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 33871 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: bug#33871: 27.0.50; Revert Dired window saved in window configuration
Date: Thu, 17 Feb 2022 11:05:56 +0100
> 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




This bug report was last modified 1 year and 102 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.