From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Re: Inhibit more keyboard event during execution of function Date: Tue, 29 Dec 2009 14:56:16 -0800 (PST) Organization: http://groups.google.com Message-ID: <3319a472-2e05-4ab2-99fd-02384eb14ab6@j4g2000yqe.googlegroups.com> References: <87skauojkb.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1262130110 25619 80.91.229.12 (29 Dec 2009 23:41:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Dec 2009 23:41:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 30 00:41:43 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 1NPlh8-0008Oi-H6 for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Dec 2009 00:41:42 +0100 Original-Received: from localhost ([127.0.0.1]:46098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NPlh8-0002Vg-U5 for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Dec 2009 18:41:42 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!postnews.google.com!j4g2000yqe.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 21 Original-NNTP-Posting-Host: 83.183.114.227 Original-X-Trace: posting.google.com 1262127376 28649 127.0.0.1 (29 Dec 2009 22:56:16 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 29 Dec 2009 22:56:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j4g2000yqe.googlegroups.com; posting-host=83.183.114.227; posting-account=JZUL_goAAACG6LHeukNrrFi20WGR0noj User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.43 Safari/532.5, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:175874 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:70948 Archived-At: On Dec 28, 10:49=A0pm, 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? 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?