unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <murray@math.umass.edu>
Cc: help-gnu-emacs@gnu.org
Subject: RE: Gnu emacs under Windows: .emacs and _emacs and savehist
Date: Wed, 11 Jul 2007 11:48:13 -0700	[thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICMEPHDNAA.drew.adams@oracle.com> (raw)
In-Reply-To: <4694E478.6060703@math.umass.edu>

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

  parent reply	other threads:[~2007-07-11 18:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-11  4:04 Gnu emacs under Windows: .emacs and _emacs and savehist Murray Eisenberg
2007-07-11  8:54 ` Peter Dyballa
2007-07-11 11:29 ` Jason Rumney
2007-07-11 11:34   ` Jason Rumney
2007-07-11 14:10   ` Murray Eisenberg
2007-07-11 14:58     ` Vagn Johansen
2007-07-11 15:31     ` Peter Dyballa
2007-07-11 15:50       ` Lennart Borgman (gmail)
     [not found] ` <mailman.3317.1184144075.32220.help-gnu-emacs@gnu.org>
2007-07-11 14:08   ` Murray Eisenberg
2007-07-11 15:24     ` Peter Dyballa
     [not found]     ` <mailman.3344.1184167477.32220.help-gnu-emacs@gnu.org>
2007-07-11 16:25       ` Murray Eisenberg
2007-07-11 17:16         ` Peter Dyballa
2007-07-11 18:48     ` Drew Adams [this message]
     [not found] <mailman.3365.1184179766.32220.help-gnu-emacs@gnu.org>
2007-07-12 16:52 ` Murray Eisenberg
2007-07-12 17:05   ` Peter Dyballa
2007-07-12 17:09   ` Drew Adams
     [not found] <mailman.3405.1184260312.32220.help-gnu-emacs@gnu.org>
2007-07-12 22:03 ` David Kastrup
2007-07-12 23:21   ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DNEMKBNJBGPAOPIJOOICMEPHDNAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=murray@math.umass.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).