From: storm@cua.dk (Kim F. Storm)
Cc: Hrvoje Niksic <hniksic@xemacs.org>, emacs-devel@gnu.org
Subject: Re: Use .emacs.d in savehist.el
Date: Mon, 24 Oct 2005 23:22:44 +0200 [thread overview]
Message-ID: <m3fyqqwqxn.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <87u0f69ae6.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 24 Oct 2005 11:58:50 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Any objection to the patch below?
I like it.
But shouldn't it create .emacs.d if it doesn't already exist?
I can think of several other packages which can benefit from
this functionality (e.g. ido), so what about writing a function
which can make the decision on the fly --
and preferably move old files to .emacs.d.
Something like this [not tested]
(defcustom savehist-file
(expand-saved-state-file "history" "~/.emacs-history")
"...")
(defun expand-saved-state-file (name &optional oldname)
"Return expanded file-name NAME in directory ~/.emacs.d.
If OLDNAME exists, move that file into NAME, or delete OLDNAME if NAME
already exists."
(let ((file (expand-file-name name "~/.emacs.d"))
(oldfile (and oldname (expand-file-name oldname))))
(if (and oldfile (file-exists-p oldfile))
(if (file-exists-p file)
(delete-file oldfile)
(rename oldfile file)))
file))
>
>
> Stefan
>
>
> Index: lisp/savehist.el
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/savehist.el,v
> retrieving revision 1.7
> diff -u -r1.7 savehist.el
> --- lisp/savehist.el 22 Oct 2005 17:45:50 -0000 1.7
> +++ lisp/savehist.el 24 Oct 2005 15:55:38 -0000
> @@ -110,7 +73,13 @@
> :type '(repeat (symbol :tag "Variable"))
> :group 'savehist)
>
> -(defcustom savehist-file "~/.emacs-history"
> +(defcustom savehist-file
> + (cond
> + ;; Backward compatibility with previous versions of savehist.
> + ((file-exists-p "~/.emacs-history") "~/.emacs-history")
> + ((and (not (featurep 'xemacs)) (file-directory-p "~/.emacs.d/"))
> + "~/.emacs.d/history")
> + (t "~/.emacs-history"))
> - "*File name to save minibuffer history to.
> + "File name to save minibuffer history to.
> The minibuffer history is a series of Lisp expressions, which should be
> loaded using `savehist-load' from your .emacs. See `savehist-load' for
>
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
>
>
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
next prev parent reply other threads:[~2005-10-24 21:22 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-24 15:58 Use .emacs.d in savehist.el Stefan Monnier
2005-10-24 21:22 ` Kim F. Storm [this message]
2005-10-25 20:27 ` Richard M. Stallman
2005-10-25 9:30 ` Hrvoje Niksic
2005-10-25 14:30 ` David Kastrup
2005-10-25 14:51 ` Stefan Monnier
2005-10-25 19:13 ` Hrvoje Niksic
[not found] ` <87oe5e977f.fsf@mahaena.lrde>
2005-10-25 9:59 ` Michael Cadilhac
2005-10-25 14:54 ` Stefan Monnier
2005-10-26 16:46 ` Richard M. Stallman
2005-10-26 23:28 ` Miles Bader
2005-10-27 3:58 ` Richard M. Stallman
2005-10-27 16:53 ` Kevin Rodgers
2005-10-28 16:19 ` Richard M. Stallman
2005-10-28 20:16 ` Miles Bader
2005-10-29 5:12 ` Richard M. Stallman
2005-10-29 17:31 ` Kim F. Storm
2005-10-30 0:03 ` Miles Bader
2005-10-29 3:51 ` Chong Yidong
2005-10-29 20:33 ` Richard M. Stallman
2005-10-30 4:00 ` Chong Yidong
2005-10-30 4:30 ` Miles Bader
2005-10-30 13:59 ` Chong Yidong
2005-10-31 1:14 ` Richard M. Stallman
2005-10-31 2:29 ` Chong Yidong
2005-11-01 2:14 ` Richard M. Stallman
2005-11-01 3:43 ` Chong Yidong
2005-11-01 5:12 ` Stefan Monnier
2005-11-01 12:54 ` Chong Yidong
2005-11-02 10:27 ` Richard M. Stallman
2005-11-02 15:54 ` Stefan Monnier
2005-11-02 10:26 ` Richard M. Stallman
2005-11-02 10:26 ` Richard M. Stallman
2005-10-27 9:16 ` Kim F. Storm
2005-10-30 4:07 ` Chong Yidong
2005-10-25 15:58 ` Richard M. Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3fyqqwqxn.fsf@kfs-l.imdomain.dk \
--to=storm@cua.dk \
--cc=emacs-devel@gnu.org \
--cc=hniksic@xemacs.org \
/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.
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.