I saw this somewhere and it works like charm. Add the below code to your .emacs to make it remember some things between sessions.
;; save history between sessions (setq savehist-additional-variables ;; also save... '(search-ring regexp-search-ring compile-history) ;; search and history savehist-file "~/.emacs.d/savehist") ;; where to save (savehist-mode t) ;; do customization before activate
[...] made a brief post (http://rydow.wordpress.com/2009/06/11/emacs-history-between-sessions) about savehist-mode although they couldn’t remember where they had seen the original. Along [...]
By: Interesting Emacs Links – 2009 Week 23 « A Curious Programmer on June 14, 2009
at 21:29