Lots of emacs fixes and tweaks.
And now lets set the editor and visual env vars.