We probably want this in common code for emacs.