I'm using Emacs.app 23.2.1 (not Aquamacs) on OS X. For coding Python, I depend on flymake to highlight mistakes. Some files it encounteres cause it to pop up a dialog:
Flymake: Configuration error has occurred while running (pyflakes yourfile.py). Flymake will be switched OFF
with 'Cancel' and 'OK' buttons.
Sometimes, however, Emacs just hangs. The OS X red/yellow/blue close/minimize/zoom buttons turn grey as if Emacs has lost focus, but it is in fact the active application. Switching tasks around and back to Emacs doesn't recover it. You can't Command-Q quit it.
When you do finally give up and kill it and restart, you've lost your work, your shells, and it doesn't save the list of recent-files.
You can disable the use of a popup for flymake with:
(setq flymake-gui-warnings-enabled nil)
This prevents flymake from alerting you that it's switching itself off, but it's better than the alternative.
The flymake-display-warning calls Emac's 'message-box' function so there may be other tools which cause the same problem.
There's also a generic variable use-dialog-box but setting it from default t to nil didn't help with flymake. There's also a suggestion on the interwebs to use defadvice to tell y-or-no-p and yes-or-no-p set use-dialog-box to nil, but again, this won't help flymake since it doesn't use those functions.