From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: Nicer way to wake sit-for up? Date: Thu, 08 Jun 2006 17:34:04 +0200 Organization: Organization?!? Message-ID: <85u06v1x1v.fsf@lola.goethe.zz> References: <1149762693.221459.141150@y43g2000cwc.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1149781270 15711 80.91.229.2 (8 Jun 2006 15:41:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Jun 2006 15:41:10 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 08 17:41:07 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FoMcv-0001aw-2W for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Jun 2006 17:40:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FoMcu-00015B-Ja for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Jun 2006 11:40:52 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:xMjNIVJvN6PYg2Ew5wERc59M3Tk= Original-Lines: 45 Original-NNTP-Posting-Date: 08 Jun 2006 17:34:34 MEST Original-NNTP-Posting-Host: e017fde2.newsread2.arcor-online.net Original-X-Trace: DXC=RL\`9PL\I0ZWlBlPAT_ljXQ5U85hF6f; TjW\KbG]kaMX[NGU2GAcMGZUj4bIjUI9\PQ1Yo0:e7@P[c[Wn>\JAZHP1\F@YcEWMR\COZTGL=7[P] Original-X-Complaints-To: usenet-abuse@arcor.de Original-Xref: shelby.stanford.edu gnu.emacs.help:139734 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:35357 Archived-At: no-spam@cua.dk (Kim F. Storm) writes: > spamfilteraccount@gmail.com writes: > >> I have a code where the command loop executes a command which is >> waiting for arriving data with sit-for. When the data arrives from the >> network a callback is invoked and I wake sit-for up with a dummy event >> like this: >> >> the callback: >> >> ... >> (setq unread-command-events (cons 'data-arrived >> unread-command-events)) >> ... >> > > I can't think of a better way here, but you can just write > > (push 'data-arrived unread-command-events) >> >> ... >> (sit-for 5) >> (if (eq (car unread-command-events) 'data-arrived) >> (setq unread-command-events (cdr unread-command-events))) >> ... > > You could arrange for the data-arrived event to be ignored, e.g. > > (define-key global-map [data-arrived] 'ignore) > > > > Perhaps, you could use ignore instead of data-arrived, i.e. > > (define-key global-map [ignore] 'ignore) > > and > > (push 'ignore unread-command-events) Maybe (push 'mouse-movement unread-command-events) would do the trick? -- David Kastrup, Kriemhildstr. 15, 44793 Bochum