[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: elisp: how to detect if a file has changed on disk
From: |
Mirko |
Subject: |
Re: elisp: how to detect if a file has changed on disk |
Date: |
Tue, 16 Dec 2008 16:41:10 -0800 (PST) |
User-agent: |
G2/1.0 |
On Dec 16, 5:51 pm, "Peter Milliken" <peter.milli...@gmail.com> wrote:
> See section 27.6 of the Elisp Manual (comparison of modification time).
>
> See also 26.3 (Reverting) for reverting mechanisms.
>
> Pete
>
> On Wed, Dec 17, 2008 at 1:03 AM, Mirko <mvuko...@nycap.rr.com> wrote:
> > Hello,
>
> > I use emacs on my desktop and laptop, and unison to synchronize
> > modified files between the machines.
>
> > But that means that after synchronization, some of the files that a
> > buffer is visiting will change, and I will have to revert the buffer.
> > I would like to automatically revert all such buffers. What function
> > can I use to test whether a the file that a buffer is visiting has
> > changed?
>
> > Thanks,
>
> > Mirko
>
>
Thank you:
(defun revert-buffers ()
"Loop over all buffers with modified files and offer to revert them"
(interactive)
(save-excursion
(dolist (buffer (buffer-list))
(unless (verify-visited-file-modtime buffer)
(set-buffer buffer)
(revert-buffer)))))
Mirko