file-notify-add-watch

file-notify-add-watch is a compiled Lisp function in `filenotify.el'.

(file-notify-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 `file-notify-rm-watch' to cancel the watch.

The returned 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:

`change' -- watch for file changes
`attribute-change' -- watch for file attributes changes, like
permissions or modification time

If FILE is a directory, 'change' watches for file creation or
deletion in that directory. This does not work recursively.

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:

`created' -- FILE was created
`deleted' -- FILE was deleted
`changed' -- FILE has changed
`renamed' -- FILE has been renamed to FILE1
`attribute-changed' -- a FILE attribute was changed

FILE is the name of the file whose event is being reported.