help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Gnu emacs under Windows: .emacs and _emacs and savehist


From: Drew Adams
Subject: RE: Gnu emacs under Windows: .emacs and _emacs and savehist
Date: Wed, 11 Jul 2007 11:48:13 -0700

> The manual says ".emacs" although other docs, for Windows emacs, say
> "_emacs" will do.

Yes, _emacs also works, at least on MS Windows. I use _emacs, for Emacs 20,
21, and 22 - it works fine.

> So I changed the file to ".emacs" and instead of
> pointing save-hist to a file in directory .emacs,

.emacs is not a directory; it is an initialization file. If you use _emacs,
then you don't also need .emacs; they serve the same purpose: init file.

I don't explicitly point `savehist-file' anywhere; I use the default value,
which is ~/.emacs-history. You can use any file you want.

> changed it to a file in directory .emacs.d.

That should be OK.

>  So here's the relevant portion of my file ~/.emacs:
>
>    (require 'savehist)
>    (setq savehist-file "~/.emacs.d/history")
>    (setq savehist-length 1000)
>    (savehist-load)
>    (setq savehist-mode 1)

IIUC, savehist-load and savehist-mode do the same thing. savehist-mode
replaces savehist-load, which is now obsolete. If your version of
savehist.el defines savehist-mode, then you should not need to use
savehist-load.

Second, you should turn on the mode by using the mode function (command),
`savehist-mode', not by setting the mode variable, `savehist-mode'.

Third, AFAIK, savehist-length is also obsolete, unless you use XEmacs.

FYI, I do (only) this, in my _emacs:

(require 'savehist)
(savehist-mode 1)

Actually, I use savehist-20+.el instead of savehist.el, since it works with
any version of Emacs (20, 21, 22). If that interests you, you can get it
here: http://www.emacswiki.org/cgi-bin/wiki/savehist-20%2b.el. So, what I
really do is this:

(require 'savehist-20+)
(savehist-mode 1)

> I changed the backquote to an apostrophe; changed the directory that's
> the target of savehist-file;

`savehist-file' should point to a file, not a directory. It is the file
where your minibuffer histories will be saved.

> and as seemed to be suggested by help for
> savehist, added the line setting savehist-mode to the positive value 1.

No, that last part is wrong, I believe. Call the mode function instead.

> Now how do I USE savehist?  This I cannot discern from the documentation.

If you have things set up right, then you do nothing (beyond the `require'
and turning on `savehist-mode'). When you exit Emacs, it writes your
minibuffer histories to the file that is the value of `savehist-file'. When
you start Emacs up again, it reads the saved histories, so you can
immediately use them when Emacs reads minibuffer input.

HTH.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]