From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: The order input events are processed. Date: Sun, 10 Sep 2006 23:28:31 +0200 Message-ID: References: <87odtrrkgh.fsf@lrde.org> <87ejukt7fe.fsf@lrde.org> <87zmd7x3qk.fsf@lrde.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1157923800 27574 80.91.229.2 (10 Sep 2006 21:30:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 10 Sep 2006 21:30:00 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 10 23:29:59 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GMWsD-0000kj-SB for ged-emacs-devel@m.gmane.org; Sun, 10 Sep 2006 23:29:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GMWsD-00032U-BZ for ged-emacs-devel@m.gmane.org; Sun, 10 Sep 2006 17:29:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GMWs0-0002xx-6H for emacs-devel@gnu.org; Sun, 10 Sep 2006 17:29:40 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GMWry-0002s7-8U for emacs-devel@gnu.org; Sun, 10 Sep 2006 17:29:39 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GMWry-0002rn-0v for emacs-devel@gnu.org; Sun, 10 Sep 2006 17:29:38 -0400 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GMWt3-0002BP-8Y; Sun, 10 Sep 2006 17:30:45 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id 562ABFAC029; Sun, 10 Sep 2006 23:29:34 +0200 (CEST) Original-To: michael.cadilhac@lrde.org (=?utf-8?Q?Micha=C3=ABl?= Cadilhac) In-Reply-To: <87zmd7x3qk.fsf@lrde.org> (=?utf-8?Q?Micha=C3=ABl?= Cadilhac's message of "Sun\, 10 Sep 2006 15\:14\:59 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:59642 Archived-At: michael.cadilhac@lrde.org (Micha=C3=ABl Cadilhac) writes: > Richard Stallman writes: > >> However, I've always dreamt about an unique entry point f= or >> unread-events: unread-command-events would store direct events (u-c= -e >> =3D3D '(?a ?b)) or events as a cons, the cdr telling if input-meth= od has >> to be used (u-c-e =3D3D '(?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 >> ! (>=3D 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 (<=3D 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 =C2=AB read-event =C2=BB. 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) ((<=3D 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)))))) --=20 Kim F. Storm http://www.cua.dk