send error messages to emacs and exit on emacs stop handler