From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ilya Zakharevich Newsgroups: gmane.emacs.help Subject: Re: Inhibit more keyboard event during execution of function Date: Tue, 29 Dec 2009 22:11:58 +0000 (UTC) Organization: U.C. Berkeley Math. Department. Message-ID: References: <87skauojkb.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1262126482 16073 80.91.229.12 (29 Dec 2009 22:41:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Dec 2009 22:41:22 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 29 23:41:15 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NPkk2-0004Wq-8X for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Dec 2009 23:40:38 +0100 Original-Received: from localhost ([127.0.0.1]:48734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NPkk2-0005Yq-NJ for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Dec 2009 17:40:38 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!goblin2!goblin.stu.neva.ru!feeder.erje.net!feeder.eternal-september.org!eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Injection-Date: Tue, 29 Dec 2009 22:11:58 +0000 (UTC) Injection-Info: feeder.eternal-september.org; logging-data="2470"; mail-complaints-to="abuse@eternal-september.org" User-Agent: slrn/0.9.8.1pl1 (Linux) X-Auth-Sender: U2FsdGVkX1/rGMs122dNmgvQ9LtOPwcTEB1QiaMlyCc= Cancel-Lock: sha1:PhJKzbDIloHaTVs6WveLS6aiXgo= Original-Xref: news.stanford.edu gnu.emacs.help:175871 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:70945 Archived-At: On 2009-12-28, Mathias Dahl 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? If you sound is played syncroneously, just introduce a global variable, set it on during sound play, and do sound play conditionally - only if the variable is not set. If the play is async - may be much harder... Hope this helps, Ilya