From: storm@cua.dk (Kim F. Storm)
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: The order input events are processed.
Date: Sun, 10 Sep 2006 23:28:31 +0200 [thread overview]
Message-ID: <m3zmd78l8g.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <87zmd7x3qk.fsf@lrde.org> (Michaël Cadilhac's message of "Sun\, 10 Sep 2006 15\:14\:59 +0200")
michael.cadilhac@lrde.org (Michaël Cadilhac) writes:
> Richard Stallman <rms@gnu.org> 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 <storm@cua.dk> http://www.cua.dk
next prev parent reply other threads:[~2006-09-10 21:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-07 11:21 The order input events are processed Michaël Cadilhac
2006-09-09 20:45 ` Richard Stallman
2006-09-10 9:08 ` Michaël Cadilhac
2006-09-10 13:05 ` Richard Stallman
2006-09-10 13:14 ` Michaël Cadilhac
2006-09-10 21:28 ` Kim F. Storm [this message]
2006-09-11 14:12 ` Richard Stallman
2006-09-11 14:17 ` Kim F. Storm
2006-09-11 14:11 ` Richard Stallman
2006-09-11 14:19 ` Kim F. Storm
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=m3zmd78l8g.fsf@kfs-l.imdomain.dk \
--to=storm@cua.dk \
--cc=emacs-devel@gnu.org \
--cc=rms@gnu.org \
/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).