gfile-add-watch
gfile-add-watch is a built-in function in `C source code
'.
(gfile-add-watch FILE FLAGS CALLBACK)
Add a watch for filesystem events pertaining to FILE.
This arranges for filesystem events pertaining to FILE to be reported
to Emacs. Use `gfile-rm-watch' to cancel the watch.
Value is a descriptor for the added watch. If the file cannot be
watched for some reason, this function signals a `file-notify-error' error.
FLAGS is a list of conditions to set what will be watched for. It can
include the following symbols:
'watch-mounts' -- watch for mount events
'send-moved' -- pair 'deleted' and 'created' events caused by file
renames and send a single 'renamed' event instead
When any event happens, Emacs will call the CALLBACK function passing
it a single argument EVENT, which is of the form
(DESCRIPTOR ACTION FILE [FILE1])
DESCRIPTOR is the same object as the one returned by this function.
ACTION is the description of the event. It could be any one of the
following:
'changed' -- FILE has changed
'changes-done-hint' -- a hint that this was probably the last change
in a set of changes
'deleted' -- FILE was deleted
'created' -- FILE was created
'attribute-changed' -- a FILE attribute was changed
'pre-unmount' -- the FILE location will soon be unmounted
'unmounted' -- the FILE location was unmounted
'moved' -- FILE was moved to FILE1
FILE is the name of the file whose event is being reported. FILE1
will be reported only in case of the 'moved' event.