X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/ac3232837188f7e1c4ffe34b76edede0ccb54f5e..7b96ff9a00561c03b017c15837e7aecbb3a34073:/lisp/savehist.el diff --git a/lisp/savehist.el b/lisp/savehist.el index c2674fd4f8..d05a29f690 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el @@ -1,6 +1,6 @@ ;;; savehist.el --- Save minibuffer history. -;; Copyright (C) 1997, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 1997, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. ;; Author: Hrvoje Niksic ;; Keywords: minibuffer @@ -69,14 +69,14 @@ interface." :group 'savehist) (defcustom savehist-save-minibuffer-history t - "*If non-nil, save all recorded minibuffer histories. + "If non-nil, save all recorded minibuffer histories. If you want to save only specific histories, use `savehist-save-hook' to modify the value of `savehist-minibuffer-history-variables'." :type 'boolean :group 'savehist) (defcustom savehist-additional-variables () - "*List of additional variables to save. + "List of additional variables to save. Each element is a symbol whose value will be persisted across Emacs sessions that use savehist. The contents of variables should be printable with the Lisp printer. You don't need to add minibuffer @@ -91,21 +91,13 @@ minibuffer histories, such as `compile-command' or `kill-ring'." :group 'savehist) (defcustom savehist-ignored-variables nil ;; '(command-history) - "*List of additional variables not to save." + "List of additional variables not to save." :type '(repeat variable) :group 'savehist) (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 user-emacs-directory)) - (concat user-emacs-directory "history")) - ((and (featurep 'xemacs) (file-directory-p "~/.xemacs/")) - "~/.xemacs/history") - ;; For users without `~/.emacs.d/' or `~/.xemacs/'. - (t "~/.emacs-history")) - "*File name where minibuffer history is saved to and loaded from. + (locate-user-emacs-file "history" ".emacs-history") + "File name where minibuffer history is saved to and loaded from. The minibuffer history is a series of Lisp expressions loaded automatically when `savehist-mode' is turned on. See `savehist-mode' for more details. @@ -117,7 +109,7 @@ set to a coding system that exists in both emacsen." :group 'savehist) (defcustom savehist-file-modes #o600 - "*Default permissions of the history file. + "Default permissions of the history file. This is decimal, not octal. The default is 384 (0600 in octal). Set to nil to use the default permissions that Emacs uses, typically mandated by umask. The default is a bit more restrictive to protect @@ -126,7 +118,7 @@ the user's privacy." :group 'savehist) (defcustom savehist-autosave-interval (* 5 60) - "*The interval between autosaves of minibuffer history. + "The interval between autosaves of minibuffer history. If set to nil, disables timer-based autosaving." :type 'integer :group 'savehist) @@ -318,14 +310,15 @@ If AUTO-SAVE is non-nil, compare the saved contents to the one last saved, (dolist (elt value) (let ((start (point))) (insert " ") - (prin1 elt (current-buffer)) - ;; Try to read the element we just printed. + ;; Try to print and then to read an element. (condition-case nil - (save-excursion - (goto-char start) - (read (current-buffer))) + (progn + (prin1 elt (current-buffer)) + (save-excursion + (goto-char start) + (read (current-buffer)))) (error - ;; If reading it gets an error, comment it out. + ;; If writing or reading gave an error, comment it out. (goto-char start) (insert "\n") (while (not (eobp))