bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33458: 27.0.50; dired loses position when reverted from outside plac


From: Stephen Berman
Subject: bug#33458: 27.0.50; dired loses position when reverted from outside place
Date: Wed, 21 Nov 2018 23:33:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Wed, 21 Nov 2018 23:40:09 +0300 address@hidden 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]