all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Subject: Re: Nicer way to wake sit-for up?
Date: Thu, 08 Jun 2006 17:34:04 +0200	[thread overview]
Message-ID: <85u06v1x1v.fsf@lola.goethe.zz> (raw)
In-Reply-To: mailman.2764.1149780214.9609.help-gnu-emacs@gnu.org

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

  parent reply	other threads:[~2006-06-08 15:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-08 10:31 Nicer way to wake sit-for up? spamfilteraccount
2006-06-08 11:28 ` Johan Bockgård
2006-06-08 12:53 ` Kim F. Storm
     [not found] ` <mailman.2764.1149780214.9609.help-gnu-emacs@gnu.org>
2006-06-08 15:34   ` David Kastrup [this message]
2006-06-09  8:40     ` spamfilteraccount

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85u06v1x1v.fsf@lola.goethe.zz \
    --to=dak@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.