emacs: clean up error reporting function