* have dired always refresh on changed disk
@ 2014-09-26 19:38 Emanuel Berg
2014-09-26 20:17 ` John Mastro
[not found] ` <mailman.9750.1411762663.1147.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 9+ messages in thread
From: Emanuel Berg @ 2014-09-26 19:38 UTC (permalink / raw)
To: help-gnu-emacs
dired often tells me the disk has changed and I should
hit "g" to refresh the buffer.
Because dired knows it, it should be simple having it
always do it, automatically. (But: does dired *always*
know it?)
It could be an option as perhaps not everyone wants it
(?).
But I don't care for the status of the buffers that
aren't selected. Only when I select or open a dired
buffer, it matters to me if it is in synch or not.
The dired hooks I found are:
dired-after-readin-hook
dired-before-readin-hook
dired-load-hook
dired-mode-hook
- none of which seem to be suited (?) to do this in.
Can this be done easily or do I change the code?
--
underground experts united
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: have dired always refresh on changed disk
2014-09-26 19:38 have dired always refresh on changed disk Emanuel Berg
@ 2014-09-26 20:17 ` John Mastro
[not found] ` <mailman.9750.1411762663.1147.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 9+ messages in thread
From: John Mastro @ 2014-09-26 20:17 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
Emanuel Berg <embe8573@student.uu.se> wrote:
>
> dired often tells me the disk has changed and I should
> hit "g" to refresh the buffer.
>
> Because dired knows it, it should be simple having it
> always do it, automatically. (But: does dired *always*
> know it?)
[snip]
> Can this be done easily or do I change the code?
I think what you want is `auto-revert-mode'.
The relevant settings I use are:
(global-auto-revert-mode 1)
(setq global-auto-revert-non-file-buffers t
auto-revert-verbose nil)
This will automatically revert (i.e. update from disk) all buffers, but
you can of course limit it to Dired buffers by using the non-global
variation with `dired-mode-hook'.
--
John
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: have dired always refresh on changed disk
[not found] ` <mailman.9750.1411762663.1147.help-gnu-emacs@gnu.org>
@ 2014-09-26 21:39 ` Emanuel Berg
2014-09-27 3:19 ` Emanuel Berg
1 sibling, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2014-09-26 21:39 UTC (permalink / raw)
To: help-gnu-emacs
John Mastro <john.b.mastro@gmail.com> writes:
> I think what you want is `auto-revert-mode'.
>
> The relevant settings I use are:
>
> (global-auto-revert-mode 1) (setq
> global-auto-revert-non-file-buffers t
> auto-revert-verbose nil)
>
> This will automatically revert (i.e. update from
> disk) all buffers, but you can of course limit it to
> Dired buffers by using the non-global variation with
> `dired-mode-hook'.
No, I want this everywhere. Man, I have hacks all over
the place to keep the buffer-menu refreshed, to open
files that may have been changed without confirmation,
and so on. I will be interesting how much of that I can
dispose of now! Anyway thanks.
--
underground experts united
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: have dired always refresh on changed disk
[not found] ` <mailman.9750.1411762663.1147.help-gnu-emacs@gnu.org>
2014-09-26 21:39 ` Emanuel Berg
@ 2014-09-27 3:19 ` Emanuel Berg
2014-09-27 3:51 ` John Mastro
[not found] ` <mailman.9779.1411789931.1147.help-gnu-emacs@gnu.org>
1 sibling, 2 replies; 9+ messages in thread
From: Emanuel Berg @ 2014-09-27 3:19 UTC (permalink / raw)
To: help-gnu-emacs
John Mastro <john.b.mastro@gmail.com> writes:
> This will automatically revert (i.e. update from disk)
> all buffers, but you can of course limit it to Dired
> buffers by using the non-global variation with
> `dired-mode-hook'.
OK, I tried that for Dired only.
I spoke too soon earlier. The autorevert thing makes the
cursor move around like crazy all the time in the
buffer you are editing!
No, it is enough that the revert thing happens when a
Dired buffer is selected (or Buffer-menu buffer for
that matter) - even within Dired, autorevert in the
middle of something else isn't desirable.
--
underground experts united
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: have dired always refresh on changed disk
2014-09-27 3:19 ` Emanuel Berg
@ 2014-09-27 3:51 ` John Mastro
[not found] ` <mailman.9779.1411789931.1147.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 9+ messages in thread
From: John Mastro @ 2014-09-27 3:51 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
Emanuel Berg <embe8573@student.uu.se> wrote:
> I spoke too soon earlier. The autorevert thing makes the
> cursor move around like crazy all the time in the
> buffer you are editing!
I've never experienced that. Is some external process modifying the file
while you're editing it?
--
John
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: have dired always refresh on changed disk
[not found] ` <mailman.9779.1411789931.1147.help-gnu-emacs@gnu.org>
@ 2014-09-27 12:51 ` Emanuel Berg
2014-09-27 14:18 ` Robert Thorpe
2014-09-27 13:23 ` Emanuel Berg
1 sibling, 1 reply; 9+ messages in thread
From: Emanuel Berg @ 2014-09-27 12:51 UTC (permalink / raw)
To: help-gnu-emacs
John Mastro <john.b.mastro@gmail.com> writes:
>> I spoke too soon earlier. The autorevert thing makes
>> the cursor move around like crazy all the time in
>> the buffer you are editing!
>
> I've never experienced that. Is some external process
> modifying the file while you're editing it?
Of course not, this isn't NASA :)
I just thought that was the way it worked (it struck me
as similar to what you get with `recenter-top-bottom')
but I did think it didn't make any sense to have it do
anything unless the file had changed, so I'm happy that
what I had wasn't normal.
So OK, I'll try to reproduce it and come back with a
better description.
--
underground experts united
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: have dired always refresh on changed disk
[not found] ` <mailman.9779.1411789931.1147.help-gnu-emacs@gnu.org>
2014-09-27 12:51 ` Emanuel Berg
@ 2014-09-27 13:23 ` Emanuel Berg
2014-09-27 23:01 ` John Mastro
1 sibling, 1 reply; 9+ messages in thread
From: Emanuel Berg @ 2014-09-27 13:23 UTC (permalink / raw)
To: help-gnu-emacs
I have found that
(setq dired-auto-revert-buffer 'dired-directory-changed-p)
does partly what I want. It reverts when a dired buffer
is reselected (e.g., find-file and then a dir that
already has a buffer) and the dir has changed on disk.
This is not autorevert, which I consider not as good
(at least in this context) because
Note that this is not the same as
`auto-revert-mode' that periodically reverts at
specified time intervals.
from (describe-variable 'dired-auto-revert-buffer)
But: What it looks like, only (?) the dired commands
and find-file seem to be tuned in to this. I often go
to dired buffers from the `buffer-menu', or the keys I
have for `switch-to-buffer' (and even `other-window').
Of coures, I can put in tests if they lead to a dired
buffer, if the dir has changed, and so on.
--
underground experts united
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: have dired always refresh on changed disk
2014-09-27 12:51 ` Emanuel Berg
@ 2014-09-27 14:18 ` Robert Thorpe
0 siblings, 0 replies; 9+ messages in thread
From: Robert Thorpe @ 2014-09-27 14:18 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
Emanuel Berg <embe8573@student.uu.se> writes:
> I just thought that was the way it worked (it struck me
> as similar to what you get with `recenter-top-bottom')
AFAIK this is caused by a bug in tabulated-list.el which is used by
buffer-menu. It has been fixed in Emacs 24.4. I intend to turn
auto-revert in buffer-menus back on when that version is released.
BR,
Robert Thorpe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: have dired always refresh on changed disk
2014-09-27 13:23 ` Emanuel Berg
@ 2014-09-27 23:01 ` John Mastro
0 siblings, 0 replies; 9+ messages in thread
From: John Mastro @ 2014-09-27 23:01 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
Emanuel Berg <embe8573@student.uu.se> wrote:
> I have found that
>
> (setq dired-auto-revert-buffer 'dired-directory-changed-p)
>
> does partly what I want. It reverts when a dired buffer
> is reselected (e.g., find-file and then a dir that
> already has a buffer) and the dir has changed on disk.
Interesting, I wasn't aware of `dired-auto-revert-buffer'.
By default, `auto-revert-mode' checks the underlying file (based on time
stamps) every 5 seconds (see `auto-revert-interval'). That's worked well
in my experience but obviously YMMV.
I'm still not sure what caused the problem you mentioned earlier - your
cursor jumping around in a buffer you were editing. That would indeed be
a deal breaker, but `auto-revert-mode' "shouldn't" cause it. The only
time when `auto-revert-mode' modifies the buffer is when the file has
changed on disk. So if the file isn't being changed (apart from your own
saves) that shouldn't happen. Actually, I haven't noticed cursor jumping
even when the underlying file /is/ being modified, though I can see how
it could happen (or be perceived that way).
--
John
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-09-27 23:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-26 19:38 have dired always refresh on changed disk Emanuel Berg
2014-09-26 20:17 ` John Mastro
[not found] ` <mailman.9750.1411762663.1147.help-gnu-emacs@gnu.org>
2014-09-26 21:39 ` Emanuel Berg
2014-09-27 3:19 ` Emanuel Berg
2014-09-27 3:51 ` John Mastro
[not found] ` <mailman.9779.1411789931.1147.help-gnu-emacs@gnu.org>
2014-09-27 12:51 ` Emanuel Berg
2014-09-27 14:18 ` Robert Thorpe
2014-09-27 13:23 ` Emanuel Berg
2014-09-27 23:01 ` John Mastro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).