[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why 4 inotfy events when saving a file?
From: |
Eli Zaretskii |
Subject: |
Re: why 4 inotfy events when saving a file? |
Date: |
Mon, 11 Mar 2013 00:09:44 +0200 |
> Date: Sun, 10 Mar 2013 22:44:42 +0100
> From: Gregor Zattler <telegraph@gmx.net>
>
> saving a file from Emacs gives 4 inotify events:
>
> how to reproduce:
>
> on first terminal do:
> emacs-snapshot -nw -Q /tmp/inotify.test
> modify file
>
>
> on second terminal do
> inotifywait -m -q --format '%e %w%f' /tmp/inotify.test
>
>
> on first terminal do
> ^x^s (safe buffer)
>
> result on second terminal is:
> MODIFY /tmp/inotify.test
> OPEN /tmp/inotify.test
> MODIFY /tmp/inotify.test
> CLOSE_WRITE,CLOSE /tmp/inotify.test
>
>
> why are there so many events?
Because that's what Emacs does when it saves the file, first to the
old version, then to the new. Take a look at the implementation of
write-region, which is the primitive used by save-buffer to write the
buffer to its file, you will see all those operations there.