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

From: [email-masked]
Date: Wed, 21 Nov 2018 23:40:09 +0300

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.

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.29)
 of 2018-11-21 built on pinball
Repository revision: e01d030723aef2f90a2fc53a0b5251f29df94527
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
System Description: Gentoo/Linux

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
nil
Configured using:
 'configure --prefix=/usr --host=x86_64-pc-linux-gnu
 --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share
 --sysconfdir=/etc --localstatedir=/var/lib --disable-silent-rules
 --docdir=/usr/share/doc/emacs-vcs-27.0.9999
 --htmldir=/usr/share/doc/emacs-vcs-27.0.9999/html --libdir=/usr/lib64
 --program-suffix=-emacs-27-vcs --infodir=/usr/share/info/emacs-27-vcs
 --localstatedir=/var
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
 --without-compress-install --without-hesiod --without-pop
 --with-file-notification=inotify --enable-acl --with-dbus
 --without-modules --without-gameuser --with-gpm --without-json
 --without-kerberos --without-kerberos5 --with-lcms2 --without-xml2
 --without-mailutils --without-selinux --with-gnutls
 --without-libsystemd --with-threads --without-wide-int --with-zlib
 --with-sound=alsa --with-x --without-ns --with-gconf --with-libgmp
 --without-gsettings --without-toolkit-scroll-bars --with-gif
 --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm
 --with-imagemagick --without-xft --without-cairo --without-libotf
 --without-m17n-flt --with-x-toolkit=gtk3 --without-xwidgets
 --build=x86_64-pc-linux-gnu 'CFLAGS=-O2 -march=native' CPPFLAGS=
 'LDFLAGS=-Wl,-O1 -Wl,--as-needed''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GLIB NOTIFY
INOTIFY ACL GNUTLS ZLIB GTK3 X11 XDBE XIM THREADS LCMS2 GMP

Important settings:
  value of $LC_ALL: 
  value of $LC_COLLATE: C
  value of $LC_CTYPE: ru_RU.UTF-8
  value of $LC_MESSAGES: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: ru_RU.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv format-spec rfc822 mml mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils help-fns radix-tree cl-print debug backtrace
help-mode easymenu find-func cl-loaddefs cl-lib dired dired-loaddefs
linum elec-pair mule-util cyril-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting move-toolbar
gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 106382 7985)
 (symbols 48 20662 1)
 (strings 32 30146 2249)
 (string-bytes 1 804766)
 (vectors 16 15988)
 (vector-slots 8 521603 19532)
 (floats 8 51 206)
 (intervals 56 1248 14)
 (buffers 992 17))

-- 
WBR, Yuri