all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Restore minibuffer history, e.g. for compile commands, after restart?
@ 2007-12-08  6:07 Markus Dehmann
  2007-12-09  3:28 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Dehmann @ 2007-12-08  6:07 UTC (permalink / raw)
  To: help-gnu-emacs

How can I keep the history of minibuffer commands, e.g. the compile
commands?

I want them to be persistent, so that I can just press M-x compile
arrow-up to get the last compile command, even if I just started emacs
and haven't typed anything yet.

Thanks!
Markus

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Restore minibuffer history, e.g. for compile commands, after restart?
  2007-12-08  6:07 Restore minibuffer history, e.g. for compile commands, after restart? Markus Dehmann
@ 2007-12-09  3:28 ` Stefan Monnier
  2007-12-09  5:22   ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2007-12-09  3:28 UTC (permalink / raw)
  To: help-gnu-emacs

> How can I keep the history of minibuffer commands, e.g. the compile
> commands?

The package is called `savehist'.
Emacs-22 bundles it so you can just add (savehist-mode 1) to your .emacs.


        Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Restore minibuffer history, e.g. for compile commands, after restart?
  2007-12-09  3:28 ` Stefan Monnier
@ 2007-12-09  5:22   ` Drew Adams
  0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2007-12-09  5:22 UTC (permalink / raw)
  To: help-gnu-emacs

> > How can I keep the history of minibuffer commands, e.g. the compile
> > commands?
>
> The package is called `savehist'.
> Emacs-22 bundles it so you can just add (savehist-mode 1) to your .emacs.

And here is the same thing (CVS from 2007-11-28), but fixed so it also works
with Emacs versions prior to 22.1, if you should need that:
http://www.emacswiki.org/cgi-bin/wiki/savehist-20%2b.el

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Restore minibuffer history, e.g. for compile commands, after  restart?
       [not found] <mailman.4784.1197177791.18990.help-gnu-emacs@gnu.org>
@ 2007-12-09 17:38 ` Markus Dehmann
  2007-12-09 18:39   ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Dehmann @ 2007-12-09 17:38 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 9, 12:22 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > > How can I keep the history of minibuffer commands, e.g. the compile
> > > commands?
>
> > The package is called `savehist'.
> > Emacs-22 bundles it so you can just add (savehist-mode 1) to your .emacs.
>
> And here is the same thing (CVS from 2007-11-28), but fixed so it also works
> with Emacs versions prior to 22.1, if you should need that:http://www.emacswiki.org/cgi-bin/wiki/savehist-20%2b.el

Thanks! I have emacs 21.3.1. I installed the package and it works!

There is just one bug, and I thought I'd share it here, maybe others
experience the same: If I do M-x compile and go arrow-up to get the
most recent command it says "no preceding item", then I go "arrow-
down" and "arrow-up" again, and there it is, the most recent compile
command, from my last emacs run. Or, once I have several in the list
it won't show the most recent one on "arrow-up", but the next-to-last
one, then after pressing "arrow-down" it shows the most recent one.

Thanks!
Markus

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Restore minibuffer history, e.g. for compile commands, after restart?
  2007-12-09 17:38 ` Markus Dehmann
@ 2007-12-09 18:39   ` Drew Adams
  0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2007-12-09 18:39 UTC (permalink / raw)
  To: Markus Dehmann, help-gnu-emacs

> On Dec 9, 12:22 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > > > How can I keep the history of minibuffer commands, e.g. the compile
> > > > commands?
> >
> > > The package is called `savehist'.
> > > Emacs-22 bundles it so you can just add (savehist-mode 1) to
> > > your .emacs.
> >
> > And here is the same thing (CVS from 2007-11-28), but fixed so
> > it also works with Emacs versions prior to 22.1, if you should
> > need that: http://www.emacswiki.org/cgi-bin/wiki/savehist-20%2b.el
>
> Thanks! I have emacs 21.3.1. I installed the package and it works!
>
> There is just one bug,

Never say that. ;-)

> and I thought I'd share it here, maybe others
> experience the same: If I do M-x compile and go arrow-up to get the
> most recent command it says "no preceding item", then I go "arrow-
> down" and "arrow-up" again, and there it is, the most recent compile
> command, from my last emacs run. Or, once I have several in the list
> it won't show the most recent one on "arrow-up", but the next-to-last
> one, then after pressing "arrow-down" it shows the most recent one.

Sorry, I can't reproduce that.

My guess is that it might be a problem with vanilla `savehist.el' as well,
because I don't think I changed any of the code concerning that. Or it might
be a problem with Emacs 21's treatment of `compile-history' - that is, it
might be completely unrelated to savehist.

La petite histoire : `savehist-20+.el' is only a trivially modified
`savehist.el': it just doesn't rely upon features that older Emacs versions
don't have. Emacs developers didn't want to make the trivial changes that
would let `savehist.el' play well with other versions - they don't care
about that. So I posted `savehist-20+.el' at Emacs Wiki.

Perhaps someone else can reproduce the problem you see? Either using
`savehist-20+.el' or `savehist.el' (with Emacs 22 or later).

Try testing with a .emacs that contains only (require 'save-hist-20+). And
perhap try starting over by deleting your file `savehist-file' (default:
`~/.emacs-history').

I think you're saying that this is what you see:

1. Open Emacs, then `M-x compile RET foobar'.
2. Close and reopen Emacs.
3. `M-x compile RET <up>' shows message "no preceding item".
4. <down> shows ? (what does it show?)
5. <up> shows `foobar'.

Is that right? I don't see that. At step 3, I see `foobar'.

After step 2, visit `savehist-file'. What do you see recorded for
`compile-history'? You should see something like (setq compile-history
'("foobar")).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Restore minibuffer history, e.g. for compile commands, after  restart?
       [not found] <mailman.4805.1197225563.18990.help-gnu-emacs@gnu.org>
@ 2007-12-13 15:11 ` Markus Dehmann
  2007-12-13 18:17   ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Dehmann @ 2007-12-13 15:11 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 9, 1:39 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > On Dec 9, 12:22 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > > > > How can I keep thehistoryof minibuffer commands, e.g. the compile
> > > > > commands?
>
> > > > The package is called `savehist'.
> > > >Emacs-22 bundles it so you can just add (savehist-mode 1) to
> > > > your .emacs.
>
> > > And here is the same thing (CVS from 2007-11-28), but fixed so
> > > it also works withEmacsversions prior to 22.1, if you should
> > > need that:http://www.emacswiki.org/cgi-bin/wiki/savehist-20%2b.el
>
> > Thanks! I haveemacs21.3.1. I installed the package and it works!
>
> > There is just one bug,
>
> Never say that. ;-)
>
> > and I thought I'd share it here, maybe others
> > experience the same: If I do M-x compile and go arrow-up to get the
> > most recent command it says "no preceding item", then I go "arrow-
> > down" and "arrow-up" again, and there it is, the most recent compile
> > command, from my lastemacsrun. Or, once I have several in the list
> > it won't show the most recent one on "arrow-up", but the next-to-last
> > one, then after pressing "arrow-down" it shows the most recent one.
>
> Sorry, I can't reproduce that.
>
> My guess is that it might be a problem with vanilla `savehist.el' as well,
> because I don't think I changed any of the code concerning that. Or it might
> be a problem withEmacs21's treatment of `compile-history' - that is, it
> might be completely unrelated to savehist.
>
> La petite histoire : `savehist-20+.el' is only a trivially modified
> `savehist.el': it just doesn't rely upon features that olderEmacsversions
> don't have.Emacsdevelopers didn't want to make the trivial changes that
> would let `savehist.el' play well with other versions - they don't care
> about that. So I posted `savehist-20+.el' atEmacsWiki.
>
> Perhaps someone else can reproduce the problem you see? Either using
> `savehist-20+.el' or `savehist.el' (withEmacs22 or later).
>
> Try testing with a .emacsthat contains only (require 'save-hist-20+). And
> perhap try starting over by deleting your file `savehist-file' (default:
> `~/.emacs-history').
>
> I think you're saying that this is what you see:
>
> 1. OpenEmacs, then `M-x compile RET foobar'.
> 2. Close and reopenEmacs.
> 3. `M-x compile RET <up>' shows message "no preceding item".
> 4. <down> shows ? (what does it show?)
> 5. <up> shows `foobar'.
>
> Is that right? I don't see that. At step 3, I see `foobar'.
>

Sorry for the late reply!

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')

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.

> 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'? If you want me to do M-x savehist-file --
that's not available. Or did you mean something else? (sorry, although
I'm a heavy emacs user, I'm not an expert in the jargon! ;-)

--Markus

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Restore minibuffer history, e.g. for compile commands, after restart?
  2007-12-13 15:11 ` Markus Dehmann
@ 2007-12-13 18:17   ` Drew Adams
  0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2007-12-13 18:17 UTC (permalink / raw)
  To: Markus Dehmann, help-gnu-emacs

> 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
command `compile'.

> > 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
variable.

In sum, check the saved value of `compile-history'. If it looks good, then
the problem is not with savehist.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-12-13 18:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-08  6:07 Restore minibuffer history, e.g. for compile commands, after restart? Markus Dehmann
2007-12-09  3:28 ` Stefan Monnier
2007-12-09  5:22   ` Drew Adams
     [not found] <mailman.4784.1197177791.18990.help-gnu-emacs@gnu.org>
2007-12-09 17:38 ` Markus Dehmann
2007-12-09 18:39   ` Drew Adams
     [not found] <mailman.4805.1197225563.18990.help-gnu-emacs@gnu.org>
2007-12-13 15:11 ` Markus Dehmann
2007-12-13 18:17   ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.