unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Veli-Pekka Tätilä" <vtatila@gmailRemoveToReply.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Audio Feedback in Flymake: Easily  Extending Flymake Itself
Date: Fri, 10 Oct 2008 00:14:49 +0300	[thread overview]
Message-ID: <48ee7368$0$25395$9b536df3@news.fv.fi> (raw)
In-Reply-To: 48ed96d8$0$25383$9b536df3@news.fv.fi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1866 bytes --]

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, <smile>. 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




      reply	other threads:[~2008-10-09 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-09  5:33 Audio Feedback in Flymake: Easily Extending Flymake Itself Veli-Pekka Tätilä
2008-10-09 21:14 ` Veli-Pekka Tätilä [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='48ee7368$0$25395$9b536df3@news.fv.fi' \
    --to=vtatila@gmailremovetoreply.com \
    --cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).