[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16519: 24.3.50; gfile notifications not received in batch mode

From: Eli Zaretskii
Subject: bug#16519: 24.3.50; gfile notifications not received in batch mode
Date: Wed, 29 Jan 2014 20:14:19 +0200

> From: Michael Albinus <address@hidden>
> Cc: address@hidden
> Date: Mon, 27 Jan 2014 17:08:35 +0100
> Michael Albinus <address@hidden> writes:
> > I don't know what it needs on w32 to get the file notification
> > events. Is it sit-for?

No, it seems to be read-event, see below.

> Finally, the following seems to work for all three file notification
> libraries in interactive mode, and for inotify in batch mode:
> (defmacro file-notify--wait-for-events (timeout until)
>   "Wait for file notification events until form UNTIL is true.
> TIMEOUT is the maximum time to wait for, in seconds."
>   `(with-timeout (,timeout (ignore))
>      (while (null ,until)
>        (let (noninteractive)
>         (sit-for 0.1 'nodisplay)))))
> I am not able to test w32notify in batch mode. The following call from a
> CMD terminal works fine for me:
> C:\>"C:\Program Files\emacs\bin\runemacs.exe" -Q -l Y:\file-notify-tests.el 
> -f ert

How do you mean "works for me"?  The 02 test fails, doesn't it?  If I
type "2" to the prompt, I get 1 unexpected failure and 1 skipped test.

I need this change to file-notify-tests.el to get it to work with w32
in interactive mode (both -nw and GUI sessions work):

=== modified file 'test/automated/file-notify-tests.el'
--- test/automated/file-notify-tests.el 2014-01-27 19:10:02 +0000
+++ test/automated/file-notify-tests.el 2014-01-29 18:05:42 +0000
@@ -188,7 +188,8 @@ TIMEOUT is the maximum time to wait for,
   `(with-timeout (,timeout (ignore))
      (while (null ,until)
        (let (noninteractive)
-        (sit-for 0.1 'nodisplay)))))
+        (sit-for 0.1 'nodisplay)
+        (read-event)))))
 (ert-deftest file-notify-test02-events ()
   "Check file creation/removal notifications."

If we don't call read-event, the notifications are not read, since
evidently the read_socket_hook isn't called.

> However, the batch-mode equivalent returns immediately without running
> the test:
> C:\>"C:\Program Files\emacs\bin\runemacs.exe" -batch -Q -l 
> Y:\file-notify-tests.el -f ert-run-tests-batch-and-exit
> What do I miss?

Don't run runemacs.exe, run emacs.exe instead.  I have no idea what
will runemacs do in batch mode.

(I also run emacs.exe in the interactive invocation.  runemacs.exe has
only one purpose: to invoke Emacs from a desktop icon without opening
a console window.)

Anyway, the read-event thing doesn't solve the -batch operation:
notifications don't come in and Emacs is stuck until I type something
on the keyboard.  I will need more debugging to understand what is
going on.  One thing is clear: the way the notifications get to the
event queue is different for every back-end, so naive assumptions,
like just let it sit-for for a while, are usually wrong.

Btw, why did you need to bind noninteractive to nil?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]