summaryrefslogtreecommitdiff
path: root/doc/lispref/os.texi
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2015-10-26 16:46:48 +0100
committerMichael Albinus <michael.albinus@gmx.de>2015-10-26 16:46:48 +0100
commit0d9c67236cab3ffe9a8f1276e93a32e437c09bfc (patch)
treecb63c930538f2761c47aadaa49e5f099a1b330d2 /doc/lispref/os.texi
parent934bfb933f4981b2edaa208186e2f8781ab6cb9f (diff)
downloademacs-0d9c67236cab3ffe9a8f1276e93a32e437c09bfc.tar.gz
Further work on `stopped' events in filenotify.el
* doc/lispref/os.texi (File Notifications): Rework examples. * lisp/filenotify.el (file-notify--rm-descriptor): Optional parameter. (file-notify--rm-descriptor, file-notify-callback): Improve check for sending `stopped' event. (file-notify-add-watch): Check for more events for `inotify'. * test/automated/file-notify-tests.el (file-notify--test-expected-events): New defvar. (file-notify--test-with-events): Use it. (file-notify--test-cleanup): Make it more robust when deleting directories. (file-notify--test-event-test): Check also for watched directories. (file-notify--test-event-handler): Suppress temporary .#files. (file-notify-test02-events, file-notify-test04-file-validity): Rework `stopped' events. (file-notify-test05-dir-validity): Wait for events when appropriate.
Diffstat (limited to 'doc/lispref/os.texi')
-rw-r--r--doc/lispref/os.texi45
1 files changed, 37 insertions, 8 deletions
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 0160de82086..7050df86a18 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -2697,6 +2697,11 @@ watch library. Otherwise, the actions @code{deleted} and
(rename-file "/tmp/foo" "/tmp/bla")
@result{} Event (35025468 renamed "/tmp/foo" "/tmp/bla")
@end group
+
+@group
+(delete-file "/tmp/bla")
+ @result{} Event (35025468 deleted "/tmp/bla")
+@end group
@end example
@end defun
@@ -2718,15 +2723,15 @@ also makes it invalid.
@example
@group
-(setq desc (file-notify-add-watch
- "/tmp/foo" '(change) 'my-notify-callback))
- @result{} 35025468
+(make-directory "/tmp/foo")
+ @result{} nil
@end group
@group
-(write-region "foo" nil "/tmp/foo")
- @result{} Event (35025468 created "/tmp/foo")
- Event (35025468 changed "/tmp/foo")
+(setq desc
+ (file-notify-add-watch
+ "/tmp/foo" '(change) 'my-notify-callback))
+ @result{} 35025468
@end group
@group
@@ -2735,8 +2740,32 @@ also makes it invalid.
@end group
@group
-(delete-file "/tmp/foo")
- @result{} Event (35025468 deleted "/tmp/foo")
+(write-region "bla" nil "/tmp/foo/bla")
+ @result{} Event (35025468 created "/tmp/foo/.#bla")
+ Event (35025468 created "/tmp/foo/bla")
+ Event (35025468 changed "/tmp/foo/bla")
+ Event (35025468 changed "/tmp/foo/.#bla")
+@end group
+
+@group
+;; Deleting a file in the directory doesn't invalidate the watch.
+(delete-file "/tmp/foo/bla")
+ @result{} Event (35025468 deleted "/tmp/foo/bla")
+@end group
+
+@group
+(write-region "bla" nil "/tmp/foo/bla")
+ @result{} Event (35025468 created "/tmp/foo/.#bla")
+ Event (35025468 created "/tmp/foo/bla")
+ Event (35025468 changed "/tmp/foo/bla")
+ Event (35025468 changed "/tmp/foo/.#bla")
+@end group
+
+@group
+;; Deleting the directory invalidates the watch.
+(delete-directory "/tmp/foo" 'recursive)
+ @result{} Event (35025468 deleted "/tmp/foo/bla")
+ Event (35025468 deleted "/tmp/foo")
Event (35025468 stopped "/tmp/foo")
@end group