rewrite for emacs24