bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#11447: 24.1.50; notifications-notify eats keystrokes


From: Stefan Monnier
Subject: bug#11447: 24.1.50; notifications-notify eats keystrokes
Date: Fri, 11 May 2012 13:28:49 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

>>> (with-timeout ((if timeout (/ timeout 1000.0) 25))
>>> (while (eq (gethash key dbus-return-values-table :ignore) :ignore)
>>> (or (input-pending-p) (sit-for 0.1 'nodisp))))
>> Well, actually if you use sit-for you don't need input-pending-p.
> OK.

>>> With the example in this bug report, I get blocked then.
>> What do you mean by "blocked"?
> An input char goes into unread-command-event.

Why?  Who puts it there?

> Since nobody handles it, the while-loop runs forever.

I think I understand what you mean: you mean that while you do `sit-for'
you actually want to run the code associated with the incoming events,
since that code might be the one which changes dbus-return-values-table.

So, indeed sit-for and input-pending-p won't cut it.  Your code looks
OK, then, though you don't need to use a 0.1 timeout, AFAICT.

And in order to avoid the (let (unread-command-events) ...), I'd do
something like:

   (let ((seen ()))
     (unwind-protect
         (let ((event (read-event)))
           (when (and event (not (ignore-errors (dbus-check-event event))))
             (push event seen)))
       (setq unread-command-events
             (append unread-command-events (nreverse seen)))))


-- Stefan





reply via email to

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