emacs: move functions in separate file and tune smart-window mode