more emacs lib/ref cleanup