emacs: complete refactor