When you start Emacs, Session restores various variables from your last session
http://emacs-session.sourceforge.net/