From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Veli-Pekka Tätilä" Newsgroups: gmane.emacs.help Subject: Re: Audio Feedback in Flymake: Easily Extending Flymake Itself Date: Fri, 10 Oct 2008 00:14:49 +0300 Organization: FINNET customers Message-ID: <48ee7368$0$25395$9b536df3@news.fv.fi> References: <48ed96d8$0$25383$9b536df3@news.fv.fi> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1223588447 15984 80.91.229.12 (9 Oct 2008 21:40:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Oct 2008 21:40:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 09 23:41:44 2008 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 1Ko3GQ-0003ay-NK for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Oct 2008 23:41:42 +0200 Original-Received: from localhost ([127.0.0.1]:52848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ko3FM-0001ma-LF for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Oct 2008 17:40:36 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!uio.no!fi.sn.net!newsfeed1.fi.sn.net!news.song.fi!not-for-mail Original-Newsgroups: gnu.emacs.help X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Response Original-Lines: 46 Original-NNTP-Posting-Host: 82-128-218-109-Karjasilta-TR1.suomi.net Original-X-Trace: 1223586664 news.fv.fi 25395 82.128.218.109:1151 Original-X-Complaints-To: abuse@news.fv.fi Original-Xref: news.stanford.edu gnu.emacs.help:163293 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:58638 Archived-At: Hi list, Once again, I did some basic learning on my own, and was able to come up with a passable solution, TIMTOWTDI. Probably far from idiomatic, but it gets the job done in my basic testing. I looked at the flymake code, finding the flymake-report-status function called with the error and warnings count string, formatted like "%d/%d". Looking at the calls to that function, the only one having a non-empty error string is the one that posts the updated error and warnings counts on the mode line. In case of no errors or no warnings, it does not post 0/0. Here's what I added in my .emacs file: (defadvice flymake-report-status (before beep-on-flymake-failure (e-w &optional status) activate) "Play not_ok.wav in ~/emacs if we have a non-empty error count string." (if (and e-w (> (length e-w) 0 ) ) (play-sound-file "~/emacs/not_ok.wav") ) ; if ) ; advice The ending comments make it easier to mentally track the parens, with a screen reader. I have also realized that playing another wav in the else case is a bad idea as every succesful syntax check would beep reassuringly. That's far too often to be gratifying, . Plus the sounds play synchronously, on Win32 at least, ouch, so I'm keeping things brief. As in my OS sound scheme, the error is a 40 ms quiet burst of pinkish noise. On a side note, Is there an easy way to only get the syntax chekc after a time out, on leaving the current line? OFten I leave the cursor on what I'm editing and start thinking, yet my statement may well be in a syntactically incorrect state at that point. I don't always hit C-j at the ends of lines, either, if I'm editing an existing statement in stead. Hope this helps somebody else some day, too. -- With kind regards Veli-Pekka Tätilä Accessibility, Apps and Coding plus Synths and Music: http://vtatila.kapsi.fi