help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inhibit more keyboard event during execution of function


From: Mathias Dahl
Subject: Re: Inhibit more keyboard event during execution of function
Date: Tue, 29 Dec 2009 14:56:16 -0800 (PST)
User-agent: G2/1.0

On Dec 28, 10:49 pm, Mathias Dahl <address@hidden> wrote:
> I have made a small game for my kid that lets him press a key and that
> will play a sound and display an image. It is implemented as a major
> mode with a keymap where each key is defined using `define-key' and
> bound to a special play command with a string of what to play (say,
> "cow"). Now, it works for me, but when I tested this on my son today he
> kept the key pressed way longer than I do, with the effect that the key
> repeats, playing the sound many times. Quite annoying. Is there a way to
> get around this? I have been thinking of having some timing built in so
> that I will not play again unless a certain time has passed.
>
> Also, even though I tell Emacs to draw the image first (using
> `insert-image-file'), it is not displayed until the sound has stopped
> playing (I use `play-sound-file'). Any way around this?

I solved the first problem by saving the time when the sound is
playing and then refusing to play a sound again until at least a
second has passed. Feels ugly but seems to work okay.

Any takers on the second problem? Can I force redisplay of the image
in the display buffer before the sound is played?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]