unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 16519@debbugs.gnu.org
Subject: bug#16519: 24.3.50; gfile notifications not received in batch mode
Date: Fri, 31 Jan 2014 17:17:12 +0200	[thread overview]
Message-ID: <83r47o5gg7.fsf@gnu.org> (raw)
In-Reply-To: <87ppn8gs1j.fsf@gmx.de>

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: 16519@debbugs.gnu.org
> Date: Fri, 31 Jan 2014 15:11:20 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> `sit-for' calls `read-event', if `input-pending-p' returns nil. So it
> >> shall be safe to call.
> >
> > Obviously, input-pending-p returns non-nil on Windows, so read-event
> > is never called.
> 
> Out of curiosity: why? We are in batch mode.

I didn't really debug that part, so what's below might be my
imagination (though the fact that input-pending-p returns non-nil is
verified).  That said, it doesn't make much difference to Emacs on
Windows whether we are in batch mode or in console (i.e. -nw) mode.
We still read the keyboard using the same Windows APIs (see
w32inevt.c), and so we still see the console events that Windows sends
us.  Those events are strange, and not all of them are documented, but
they do arrive.

More generally, you can never rely on what kind of input events are
sent to Emacs in any mode.  This is inherently system-dependent,
especially with today's systems that have any number of channels to
send events to a program.

> > If we want sit-for to call read-event, then let's call read-event
> > directly.  Why risk platform-specific behavior in delicate functions
> > like input-pending-p? what does it gain us here?  sit-for does nothing
> > useful except call read-event.
> 
> The reason that I have preferred sit-for over read-event is, that
> sit-for puts the events back to unread-command-events.

If we need this part, we can simply copy the relevant portion of
sit-for into file-notify-tests.el.

> Likely, we don't need this in the test cases we're speaking about,
> but the code shall give also how-to-use examples to people. sit-for
> seems to be cleaner to me in this respect.

Maybe we should have ert-sit-for, then, which does everything like
sit-for, except relying on input-pending-p?

> >   #ifndef HAVE_DBUS  /* We want to read D-Bus events in batch mode.  */
> >     if (noninteractive
> > 	/* In case we are running as a daemon, only do this before
> > 	   detaching from the terminal.  */
> > 	|| (IS_DAEMON && daemon_pipe[1] >= 0))
> >       {
> > 	int c = getchar ();
> > 	XSETINT (obj, c);
> > 	*kbp = current_kboard;
> > 	return obj;
> >       }
> >   #endif	/* ! HAVE_DBUS  */
> 
> I remember. I've added the !HAVE_DBUS prepocessor statetements due to
> Bug#11415. It was a similar situation, D-Bus events were not read in
> batch mode. So we really need a changed handling of special events in
> the main loop, instead of adding more preprocessor lines.

I don't see why we would need a separate queue for special events.
What we need, perhaps, is a way to peek at stdin to see whether
there's some input ready to be gobbled.  Shouldn't select/pselect
already provide that?  IOW, there should be no need to call getchar at
all at this point.

> > If you still don't see the failure, is it possible that you have some
> > local uncommitted changes?
> 
> Guaranteed not :-)
> 
> I cannot and I do not compile w32 versions of Emacs. The only changes
> are in file-notify-tests.el, where I add traces etc pp.

I meant uncommitted changes in file-notify-tests.el.

> > As for the need to call read-event in file-notify--wait-for-events on
> > w32, if no other build needs that, I guess we can condition that call
> > on windows-nt.  But given the above discussion, I think we should do
> > the opposite: call read-event directly on _all_ platforms.
> 
> I will run some tests for that. Then we can switch to use read-event.

Thanks.





  reply	other threads:[~2014-01-31 15:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-09 14:35 bug#13662: 24.3.50; inotify-add-watch fails in batch mode Chong Yidong
2014-01-17 11:56 ` Michael Albinus
2014-01-25 14:16   ` Eli Zaretskii
2014-01-26 15:55     ` Michael Albinus
2014-01-26 16:09     ` bug#16519: 24.3.50; gfile notifications not received " Michael Albinus
2014-01-26 17:43       ` Michael Albinus
2014-01-27 16:08       ` Michael Albinus
2014-01-29 18:14         ` Eli Zaretskii
2014-01-30 10:03           ` Michael Albinus
2014-01-30 17:03             ` Eli Zaretskii
2014-01-31 14:11               ` Michael Albinus
2014-01-31 15:17                 ` Eli Zaretskii [this message]
2014-01-31 16:00                   ` Michael Albinus
2014-01-31 16:53                     ` Eli Zaretskii
2014-02-03 13:31                       ` Michael Albinus
2014-02-03 16:13                         ` Eli Zaretskii
2014-02-04 11:43                           ` Michael Albinus
  -- strict thread matches above, loose matches on Subject: below --
2014-01-22  9:50 Michael Albinus
2014-01-22 15:49 ` Eli Zaretskii
2014-01-24 11:23   ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83r47o5gg7.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=16519@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).