/* This is a list, elements are (DESCRIPTOR FILE FLAGS CALLBACK [DIRLIST]). */
static Lisp_Object watch_list;
+/* Pending events, being the target of a rename operation.
+ Items are (INODE FILE-NAME LAST-MOD LAST-STATUS-MOD SIZE). */
+static Lisp_Object pending_events;
+
/* Generate a list from the directory_files_internal output.
Items are (INODE FILE-NAME LAST-MOD LAST-STATUS-MOD SIZE). */
Lisp_Object
/* Search for an entry with the same inode. */
old_entry = XCAR (dl);
- new_entry = Fassoc (XCAR (old_entry), new_dl);
+ new_entry = assq_no_quit (XCAR (old_entry), new_dl);
if (! NILP (Fequal (old_entry, new_entry))) {
/* Both entries are identical. Nothing to do. */
new_dl = Fdelq (new_entry, new_dl);
new_entry = XCAR (dl1);
if (strcmp (SSDATA (XCAR (XCDR (old_entry))),
SSDATA (XCAR (XCDR (new_entry)))) == 0) {
- kqueue_generate_event
- (watch_object, Fcons (Qwrite, Qnil), XCAR (XCDR (old_entry)), Qnil);
+ pending_events = Fcons (new_entry, pending_events);
new_dl = Fdelq (new_entry, new_dl);
goto the_end;
}
}
- /* The file has been deleted. */
- kqueue_generate_event
- (watch_object, Fcons (Qdelete, Qnil), XCAR (XCDR (old_entry)), Qnil);
+ new_entry = assq_no_quit (XCAR (old_entry), pending_events);
+ if (NILP (new_entry))
+ /* The file has been deleted. */
+ kqueue_generate_event
+ (watch_object, Fcons (Qdelete, Qnil), XCAR (XCDR (old_entry)), Qnil);
+ else {
+ /* The file has been renamed. */
+ kqueue_generate_event
+ (watch_object, Fcons (Qrename, Qnil),
+ XCAR (XCDR (old_entry)), XCAR (XCDR (new_entry)));
+ new_dl = Fdelq (new_entry, new_dl);
+ }
the_end:
dl = XCDR (dl);
globals_of_kqueue (void)
{
watch_list = Qnil;
+ pending_events = Qnil;
}
void
(write-region "" nil file nil 'no-message))
(dolist (file y-file-list)
(write-region "" nil file nil 'no-message)))
- (file-notify--test-with-events (cond
- ;; XXX Different results?
- ((featurep 'kqueue)
- (append (make-list n 'changed)
- (make-list n 'deleted)))
- (t (make-list n 'renamed)))
+ (file-notify--test-with-events (make-list n 'renamed)
(let ((x-file-list x-file-list)
(y-file-list y-file-list))
(while (and x-file-list y-file-list)
(delete-file file))))
(file-notify--test-cleanup)))
+(file-notify--deftest-remote file-notify-test06-many-events
+ "Check that events are not dropped remote directories.")
+
(defun file-notify-test-all (&optional interactive)
"Run all tests for \\[file-notify]."
(interactive "p")