[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The order input events are processed.
From: |
Kim F. Storm |
Subject: |
Re: The order input events are processed. |
Date: |
Sun, 10 Sep 2006 23:28:31 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
address@hidden (Michaël Cadilhac) writes:
> Richard Stallman <address@hidden> writes:
>
>> However, I've always dreamt about an unique entry point for
>> unread-events: unread-command-events would store direct events (u-c-e
>> =3D '(?a ?b)) or events as a cons, the cdr telling if input-method has
>> to be used (u-c-e =3D '(?a (?b . nil) ?c)). Does it seems crazy? [2]
>>
>> It seems ugly and complex. Not as good as the present scheme.
>
> Okey.
>
>> \(fn SECONDS &optional NODISP)"
>> ! (unless (or unread-command-events
>> ! unread-post-input-method-events
>> ! unread-input-method-events
>> ! (>= unread-command-char 0))
>
> Isn't input-pending-p enough?
>
>> ! (when (or obsolete (numberp nodisp))
>> ! (setq seconds (+ seconds (* 1e-3 nodisp)))
>> ! (setq nodisp obsolete))
>> ! (if noninteractive
>> ! (progn (sleep-for seconds) t)
>> ! (unless nodisp (redisplay))
>> ! (or (<= seconds 0)
>> ! (let ((read (read-event nil nil seconds)))
>> ! (or (null read)
>> ! (progn (push read unread-command-events) nil)))))))
>
> I was thinking of an active loop because I thought the test had to be
> made here, replacing « read-event ». If we're sure read-event will
> not take an event from unread-input-method-events here, then it's ok.
What about this version (using the fixed version of input-pending-p and
documented behaviour of redisplay, both just committed):
It used unread-post-input-method-events instead of unread-command-events
to ensure that the event is pushed back on the first list of events
processed by read-event.
(defun sit-for (seconds &optional nodisp obsolete)
"..."
(when (or obsolete (numberp nodisp))
(setq seconds (+ seconds (* 1e-3 nodisp)))
(setq nodisp obsolete))
(cond
(noninteractive
(sleep-for seconds)
t)
((input-pending-p)
nil)
((<= seconds 0)
(or nodisp (redisplay)))
(t
(or nodisp (redisplay))
(let ((read (read-event nil nil seconds)))
(or (null read)
(progn (push read unread-post-input-method-events)
nil))))))
--
Kim F. Storm <address@hidden> http://www.cua.dk