[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: automatic dired update
From: |
Paul R |
Subject: |
Re: automatic dired update |
Date: |
Mon, 05 Jan 2009 10:40:44 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
>> Does anyone know how to make dired auto-refresh? For example, i have
>> a dired buffer of dir xyz buried somewhere. Then, i renamed some
>> files in OS's Desktop. Then, when i switch to dir xyz in emacs,
>> i wish to see the updated list without me having to type g to
>> refresh. originally i thought just some hook... something like
>> (add-hook 'dired-load-hook 'revert-buffer)
>>
>> but when actually trying to do it, apparently not that simple.
>> I thought it must be some function or variable that tells me when
>> buffer display is switched or updated... can't locate it.
Drew> Good question. To use a hook to call `dired-revert', you need to
Drew> find a hook that represents the "change" in interaction state that
Drew> you make when you "switch" to the dired buffer. I'm not sure what
Drew> hook that might be.
That would only work if the dired buffer is not currently displayed when
the change happen.
I think a real solution would be to use FS notifications systems. I know
of inotify ( http://en.wikipedia.org/wiki/Inotify ) for linux but
I suspect such systems exist for most widely used systems. That would be
a very good addition to emacs.
Drew> You could use a timer or, say, `display-time-hook' to do it
Drew> periodically, but that's a sledge hammer.
As a temporary solution, a combination of :
- refresh display on "buffer gets diplayed" event
and
- refresh diplay every N seconds if buffer is already displayed
could provide the wanted effect.
Anybody aware of inotify-and-the-likes integration effort to emacs ?
--
Paul
Re: automatic dired update, Michael Heerdegen, 2009/01/05