emacs - tidy up code and fix ido history bug