[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Restore minibuffer history, e.g. for compile commands, after restart
RE: Restore minibuffer history, e.g. for compile commands, after restart?
Thu, 13 Dec 2007 10:17:27 -0800
> Okay, here is what I get with a fresh .emacs that contains only
> (require 'save-hist-20+), also I delete any old .emacs.d/history file.
> 1. open emacs, `M-x compile RET' (shows 'Compile command: make -k'),
> remove 'make -k' and type 'foobar' RET.
> 2. close and reopen emacs
> 3. M-x <up> (shows 'compile') RET (shows 'Compile command: make -k')
> 4. <up> (shows 'Beginning of buffer. No preceding item' and jumps back
> to 'Compile command: make -k')
> 5. <down> (shows 'Compile command:')
> 6. <up> (shows 'Compile command: foobar')
I assume that you also put (savehist-mode 1) in your .emacs.
> If on 6., I type <down> again, instead of <up>, I get 'End of history:
> No default available', then <up> shows 'Compile command: foobar'
> The fact that the fresh emacs shows 'make -k' as a default is kind of
> unexpected, right? May this pre-setting be the cause of the trouble?
> Note that on step 1., I did not press RET for make -k, and still it
> shows up again after restarting emacs.
If `compilation-read-command' is non-nil (the default value is t) then
"make -k" is always the default value for the compile command. To have the
default value for the compile command be the last compile command you
entered, set `compilation-read-command' to nil.
Check the value of variable `compile-history' after step 2, using `C-h v'.
If it includes the last compile command you entered, then the problem is not
with savehist. In that case, you might want to report an Emacs bug for
> > After step 2, visit `savehist-file'. What do you see recorded for
> > `compile-history'? You should see something like (setq compile-history
> > '("foobar")).
> What is 'savehist-file'?
It's the variable that tells savehist where you want to save the histories.
By default, its value is "~/.emacs-history". You can customize this
In sum, check the saved value of `compile-history'. If it looks good, then
the problem is not with savehist.