emacs: clean up and minor bugfixes.