]> code.delx.au - gnu-emacs/blobdiff - lisp/savehist.el
Simplify url handling in rcirc-mode
[gnu-emacs] / lisp / savehist.el
index 8a7bd7b7023867ad4f243393564efc3eaddee27b..653d0312a195f5b7f92ca3f8abd722c38f47af3f 100644 (file)
@@ -1,7 +1,6 @@
-;;; savehist.el --- Save minibuffer history.
+;;; savehist.el --- Save minibuffer history
 
 
-;; Copyright (C) 1997, 2005, 2006, 2007, 2008, 2009
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2005-2011  Free Software Foundation, Inc.
 
 ;; Author: Hrvoje Niksic <hniksic@xemacs.org>
 ;; Maintainer: FSF
 
 ;; Author: Hrvoje Niksic <hniksic@xemacs.org>
 ;; Maintainer: FSF
   :version "22.1"
   :group 'minibuffer)
 
   :version "22.1"
   :group 'minibuffer)
 
-;;;###autoload
-(defcustom savehist-mode nil
-  "Mode for automatic saving of minibuffer history.
-Set this by calling the `savehist-mode' function or using the customize
-interface."
-  :type 'boolean
-  :set (lambda (symbol value) (savehist-mode (or value 0)))
-  :initialize 'custom-initialize-default
-  :require 'savehist
-  :group 'savehist)
-
 (defcustom savehist-save-minibuffer-history t
   "If non-nil, save all recorded minibuffer histories.
 If you want to save only specific histories, use `savehist-save-hook' to
 (defcustom savehist-save-minibuffer-history t
   "If non-nil, save all recorded minibuffer histories.
 If you want to save only specific histories, use `savehist-save-hook' to
@@ -181,7 +169,7 @@ minibuffer history.")
 ;; Functions.
 
 ;;;###autoload
 ;; Functions.
 
 ;;;###autoload
-(defun savehist-mode (arg)
+(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.
   "Toggle savehist-mode.
 Positive ARG turns on `savehist-mode'.  When on, savehist-mode causes
 minibuffer history to be saved periodically and when exiting Emacs.
@@ -191,11 +179,7 @@ previous minibuffer history to be loaded 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."
 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."
-  (interactive "P")
-  (setq savehist-mode
-       (if (null arg)
-           (not savehist-mode)
-         (> (prefix-numeric-value arg) 0)))
+  :global t
   (if (not savehist-mode)
       (savehist-uninstall)
     (when (and (not savehist-loaded)
   (if (not savehist-mode)
       (savehist-uninstall)
     (when (and (not savehist-loaded)
@@ -214,11 +198,7 @@ which is probably undesirable."
         (setq savehist-mode nil)
         (savehist-uninstall)
         (signal (car errvar) (cdr errvar)))))
         (setq savehist-mode nil)
         (savehist-uninstall)
         (signal (car errvar) (cdr errvar)))))
-    (savehist-install)
-    (run-hooks 'savehist-mode-hook))
-  ;; Return the new setting.
-  savehist-mode)
-(add-minor-mode 'savehist-mode "")
+    (savehist-install)))
 
 (defun savehist-load ()
   "Load the variables stored in `savehist-file' and turn on `savehist-mode'.
 
 (defun savehist-load ()
   "Load the variables stored in `savehist-file' and turn on `savehist-mode'.
@@ -274,6 +254,10 @@ Normally invoked by calling `savehist-mode' to unset the minor mode."
       (cancel-timer savehist-timer))
     (setq savehist-timer nil)))
 
       (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.
 (defun savehist-save (&optional auto-save)
   "Save the values of minibuffer history variables.
 Unbound symbols referenced in `savehist-additional-variables' are ignored.
@@ -408,6 +392,5 @@ trimming of history lists to `history-length' items."
 
 (provide 'savehist)
 \f
 
 (provide 'savehist)
 \f
-;; arch-tag: b3ce47f4-c5ad-4ebc-ad02-73aba705cf9f
 
 ;;; savehist.el ends here
 
 ;;; savehist.el ends here