X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/95df8112a0cbdb06addbac5fbea03b37d4440418..531e70eca4c3bcd44942a67f5ea1a8bb1cb41dad:/lisp/savehist.el diff --git a/lisp/savehist.el b/lisp/savehist.el index f1060fb515..374e57feb1 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el @@ -1,6 +1,6 @@ -;;; savehist.el --- Save minibuffer history. +;;; savehist.el --- Save minibuffer history -;; Copyright (C) 1997, 2005-2011 Free Software Foundation, Inc. +;; Copyright (C) 1997, 2005-2013 Free Software Foundation, Inc. ;; Author: Hrvoje Niksic ;; Maintainer: FSF @@ -170,15 +170,19 @@ minibuffer history.") ;;;###autoload (define-minor-mode savehist-mode - "Toggle savehist-mode. -Positive ARG turns on `savehist-mode'. When on, savehist-mode causes -minibuffer history to be saved periodically and when exiting Emacs. -When turned on for the first time in an Emacs session, it causes the -previous minibuffer history to be loaded from `savehist-file'. + "Toggle saving of minibuffer history (Savehist mode). +With a prefix argument ARG, enable Savehist mode if ARG is +positive, and disable it otherwise. If called from Lisp, enable +the mode if ARG is omitted or nil. + +When Savehist mode is enabled, minibuffer history is saved +periodically and when exiting Emacs. When Savehist mode is +enabled for the first time in an Emacs session, it loads the +previous minibuffer history from `savehist-file'. This mode should normally be turned on from your Emacs init file. -Calling it at any other time replaces your current minibuffer histories, -which is probably undesirable." +Calling it at any other time replaces your current minibuffer +histories, which is probably undesirable." :global t (if (not savehist-mode) (savehist-uninstall) @@ -205,6 +209,7 @@ which is probably undesirable." If `savehist-file' is in the old format that doesn't record the value of `savehist-minibuffer-history-variables', that value is deducted from the contents of the file." + (declare (obsolete savehist-mode "22.1")) (savehist-mode 1) ;; Old versions of savehist distributed with XEmacs didn't save ;; savehist-minibuffer-history-variables. If that variable is nil @@ -221,7 +226,6 @@ value is deducted from the contents of the file." ;; Collect VAR, i.e. (nth form 1). (push (nth 1 form) vars)) vars))))) -(make-obsolete 'savehist-load 'savehist-mode "22.1") (defun savehist-install () "Hook savehist into Emacs. @@ -254,6 +258,10 @@ Normally invoked by calling `savehist-mode' to unset the minor mode." (cancel-timer savehist-timer)) (setq savehist-timer nil))) +;; From XEmacs? +(defvar print-readably) +(defvar print-string-length) + (defun savehist-save (&optional auto-save) "Save the values of minibuffer history variables. Unbound symbols referenced in `savehist-additional-variables' are ignored. @@ -270,6 +278,13 @@ If AUTO-SAVE is non-nil, compare the saved contents to the one last saved, (print-level nil) (print-readably t) (print-quoted t)) + ;; During the 24.3 development, read-passwd had a bug which resulted in + ;; the passwords being saved by savehist. Trim them, retroactively. + ;; This code can be removed after the 24.3 release. + (dolist (sym savehist-minibuffer-history-variables) + (if (and (symbolp sym) (equal (symbol-name sym) "forget-history")) + (setq savehist-minibuffer-history-variables + (delq sym savehist-minibuffer-history-variables)))) ;; Save the minibuffer histories, along with the value of ;; savehist-minibuffer-history-variables itself. (when savehist-save-minibuffer-history @@ -361,9 +376,11 @@ trimming of history lists to `history-length' items." "Return non-nil if VALUE is printable." (cond ;; Quick response for oft-encountered types known to be printable. - ((stringp value)) ((numberp value)) ((symbolp value)) + ;; String without properties + ((and (stringp value) + (equal-including-properties value (substring-no-properties value)))) (t ;; For others, check explicitly. (with-temp-buffer