GNU bug report logs - #20943
25.0.50; Dired buffers are not always auto-reverterd

Previous Next

Package: emacs;

Reported by: Mark Karpov <markkarpov <at> openmailbox.org>

Date: Tue, 30 Jun 2015 18:24:02 UTC

Severity: normal

Found in version 25.0.50

Done: Mark Karpov <markkarpov <at> openmailbox.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mark Karpov <markkarpov <at> openmailbox.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 20943 <at> debbugs.gnu.org
Subject: bug#20943: 25.0.50; Dired buffers are not always auto-reverted
Date: Thu, 09 Jul 2015 21:30:10 +0600
> We need to come up with a way of telling auto-revert that although the
> buffer was modified by the commands you mentioned, it's okay to revert
> it.  Can you suggest a change along those lines?

I propose two changes:

1. In ‘auto-revert-handler’, autorevert modified files if current buffer
is a Dired buffer:

(defun auto-revert-handler ()
  "Revert current buffer, if appropriate.
This is an internal function used by Auto-Revert Mode."
  (when (or auto-revert-tail-mode
            (eq major-mode dired-mode)
            (not (buffer-modified-p)))
    ...))

This removes «freezing» of modified buffers (‘auto-revert-buffer’ is
only called when auto-revert mode is enabled right? this should not
affect users who don't use auto-revert). This is what I currently
use. Control flow goes into body of ‘when’ and for Dired buffers this
boils down to conditions that check if current buffer is stale, and if
it is, then the function revert it.

2. To eliminate adverse effects (reordering of files because of
auto-revert mode), we need to write down all functions (commands) that
can insert new elements out of order in Dired buffer, then at the end of
every such a command, add:

(when auto-revert-mode
  (revert-buffer nil t t)) ;; not sure about the collection of args

This should be done only for Dired-specific commands (that are used only
in Dired mode, if there is uncertainty, add additional condition to test
that current major mode is ‘dired-mode’), of course.

In principle, a macro can be written for this set of functions, but I
don't think it's a good idea for Elisp, given such limited use case.

The only thing I cannot do myself from this is form full list of
functions that should call ‘revert-buffer’ when ‘auto-revert-mode’ is
enabled. You should be able to do it better than me.

These functions should contain reverting code in themselves because
‘auto-revert-handler’ cannot help here — its period is too long.

Maybe I don't see some corner cases? If you disagree with this plan,
let's discuss it.




This bug report was last modified 9 years and 310 days ago.

Previous Next


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