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

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

bug#20943: 25.0.50; Dired buffers are not always auto-reverted


From: Mark Karpov
Subject: bug#20943: 25.0.50; Dired buffers are not always auto-reverted
Date: Fri, 10 Jul 2015 01:42:38 +0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Michael Albinus <michael.albinus@gmx.de> writes:

> I fear this is the wrong direction to fix it. `auto-revert-handler' shall
> not know about major modes. All what a buffer has to say to
> `auto-revert-handler' must be in `buffer-stale-function', which is set to
> `dired-buffer-stale-p' here.

I can understand the desire for abstraction. The thing is that as
currently written ‘auto-revert-handler’ won't get to that part where it
calls ‘buffer-stale-function’. The ‘when’ statement cut it too early
with (not (buffer-modified-p)).

What we actually need to decide is whether this behavior will be unique
to Dired or not. I feel like it's quite unique. Dired buffer is not like
normal file buffer or anything else. So, in some way we have to check in
‘auto-revert-handler’ if we are in Dired buffer or not.

Frankly, you have three concepts that control behavior of
‘auto-revert-mode’:

* buffer associated with file (this may be used as «fourth notion»,
  although I don't know which buffers else are not associated with
  files, chances are the new behavior is not very good for anything
  other than Dired),

* modified buffer,

* stale buffer.

This is not enough to implement this new behavior, you need more
information about buffer now. So, you need fourth notion that would tell
you if current buffer is such that you can revert it even if it's
modified.

Now, if you like to keep it on more abstract level, you can introduce
some notion for this sort of buffers, buffers that should be reverted by
‘auto-revert-mode’ even when they are modified.

You can introduce a list that will enumerate major modes that define
such buffers, or implement it in some other way. Then you can have a
predicate that will tell you what if you're in such a special buffer or
not.

> What happens, if you remove the test for `buffer-read-only' from that
> function?

Sorry, I don't know which function you mean. Please be explicit, because
my knowledge of internal workings of Emacs is somewhat limited and thus
I'm bad at guessing. If you mean ‘auto-revert-handler’, it doesn't
matter, because you need to insert new condition here:

(when (or auto-revert-tail-mode
          <insert predicate here>
          (not (buffer-modified-p)))
 ...)

This is my point of view, I don't know if it's helpful.





reply via email to

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