Gordon's extensions and fixes for Emacs