views:

397

answers:

3

Just like the question title says, I'd like to save, for instance, my find-file and Meta-X history in Emacs' mini-buffer so I can recall commands later in a different session. Is there a way to do this?

+1  A: 

Does this help?

+3  A: 
M-x savehist-mode

or

(savehist-mode 1)

(available in Emacs as of 22.1)

Trey Jackson
+9  A: 

As Trey Jackson said, you want to put this:

(savehist-mode 1)

in your Emacs start up file, then restart Emacs. (Calling it interactively will stomp on your current mini-buffer history, so you may not want to do that.)

It's also worth pointing out that you can persist other variables across sessions by adding them to savehist-additional-variables, like so:

(setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))

You may also want to customize savehist-file, to pick the location where Emacs saves all this stuff:

(setq savehist-file "~/.emacs.d/tmp/savehist")
genehack
Thanks for the info on clobbering and the ability to add other history buffers. This looks like what I'm looking for.
Jonathon Watney