GNU bug report logs - #33458
27.0.50; dired loses position when reverted from outside place

Previous Next

Package: emacs;

Reported by: v88m <at> posteo.net

Date: Wed, 21 Nov 2018 20:46:01 UTC

Severity: minor

Found in version 27.0.50

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 33458 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: v88m <at> posteo.net
Cc: 33458 <at> debbugs.gnu.org
Subject: Re: bug#33458: 27.0.50;
 dired loses position when reverted from outside place
Date: Wed, 21 Nov 2018 23:33:47 +0100
On Wed, 21 Nov 2018 23:40:09 +0300 v88m <at> posteo.net wrote:

> If dired buffer reverted from outside it, cursor jumps to begin of the
> buffer once this buffer becomes current again.
>
> How to reproduce:
>
> 0. emacs -Q
>
> 1. Open some directory, say "DIR-A" in dired.
>
> 2. Move cursor to subdirectory, say "DIR-B", M-: (point) ;=> e.g. 225.
>
> 3. Dive into subdirectory "DIR-B".
>
> 4. Let's check position: M-: (with-current-buffer "DIR-A" (point)) ;=>
> 225, so cursor in the right place.
>
> 5. Revert original buffer: M-: (with-current-buffer "DIR-A" (dired-revert))
>
> 6. Check position again: M-: (with-current-buffer "DIR-A" (point)) ;=>
> 225, seems right here...
>
> 7. Switch back from the buffer with "DIR-B" to the buffer with "DIR-A".
>
> 8. Position lost! M-: (point) ;=> 1, but 225 expected.
>
> The issue very spunky if auto-revert-mode is used.
>
> Can't reproduce this issue with regular buffer, so it seems dired-specific.

I assume you used `C-x b' (switch-to-buffer) to switch back.  If so,
this happens because dired-revert erases and then repopulates the buffer
it's called on, which relocates the markers used by switch-to-buffer to
find window-point when switch-to-buffer-preserve-window-point is t,
which is it by default since Emacs 26.  If you set that variable to nil,
point will be where you expected after `C-x b'.  Alternatively, if you
use `C-x d' (i.e. M-x dired) to return to the DIR-A buffer, point will
be where you expected (even if switch-to-buffer-preserve-window-point is
t).  See bug#27243,
https://lists.gnu.org/archive/html/bug-gnu-emacs/2017-06/msg00147.html

Steve Berman




This bug report was last modified 4 years and 349 days ago.

Previous Next


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