[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Use .emacs.d in savehist.el
From: |
Kim F. Storm |
Subject: |
Re: Use .emacs.d in savehist.el |
Date: |
Mon, 24 Oct 2005 23:22:44 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> 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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-devel
>
>
--
Kim F. Storm <address@hidden> http://www.cua.dk
- Use .emacs.d in savehist.el, Stefan Monnier, 2005/10/24
- Re: Use .emacs.d in savehist.el,
Kim F. Storm <=
- Message not available
- Re: Use .emacs.d in savehist.el, Michael Cadilhac, 2005/10/25
- Re: Use .emacs.d in savehist.el, Stefan Monnier, 2005/10/25
- Re: Use .emacs.d in savehist.el, Richard M. Stallman, 2005/10/26
- Re: Use .emacs.d in savehist.el, Miles Bader, 2005/10/26
- Re: Use .emacs.d in savehist.el, Richard M. Stallman, 2005/10/26
- Re: Use .emacs.d in savehist.el, Kevin Rodgers, 2005/10/27
- Re: Use .emacs.d in savehist.el, Richard M. Stallman, 2005/10/28
- Re: Use .emacs.d in savehist.el, Miles Bader, 2005/10/28
- Re: Use .emacs.d in savehist.el, Richard M. Stallman, 2005/10/29