[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: savehist -- save minibuffer history between Emacs invocations
From: |
Simon Josefsson |
Subject: |
Re: savehist -- save minibuffer history between Emacs invocations |
Date: |
Mon, 31 Oct 2005 12:14:26 +0100 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
Hrvoje Niksic <address@hidden> writes:
> define-minor-mode doesn't work under XEmacs.
Ouch.
> And from the available documentation I understand define-minor-mode
> to be pretty much equivalent to the combination of `add-minor-mode'
> and the code I've written.
define-minor-mode also create a customizable foo-mode variable, which
load and enable the mode if it is customized in ~/.emacs.
>> Then I could simply customize the savehist-mode variable, and the
>> mode would load and enable itself automatically.
>
> If you know how to correctly achieve that with `defcustom', by all
> means let me know.
How about this patch?
Index: savehist.el
===================================================================
RCS file: /home/cvs/simon/elisp/savehist.el,v
retrieving revision 1.1
diff -u -p -u -w -r1.1 savehist.el
--- savehist.el 31 Oct 2005 10:51:56 -0000 1.1
+++ savehist.el 31 Oct 2005 11:13:30 -0000
@@ -32,10 +32,10 @@
;; variables may be specified by customizing
;; `savehist-additional-variables'.
-;; To use savehist, turn on savehist-mode by putting the following in
-;; `~/.emacs':
+;; To use savehist, turn on savehist-mode by customizing the variable
+;; `savehist-mode', or putting the following in `~/.emacs':
;;
-;; (savehist-mode 1)
+;; (require 'savehist)
;;
;; You can also explicitly save history with `M-x savehist-save' and
;; load it by loading the `savehist-file' with `M-x load'.
@@ -56,9 +56,11 @@
"Save minibuffer history."
:group 'minibuffer)
-(defvar savehist-mode nil
- "Mode for automatic saving of minibuffer history.
-Set this by calling `savehist-mode'.")
+(defcustom savehist-mode nil
+ "Mode for automatic saving of minibuffer history."
+ :type 'boolean
+ :require 'savehist
+ :group 'savehist)
(defcustom savehist-save-minibuffer-history t
"*If non-nil, save all recorded minibuffer histories.
@@ -348,6 +350,9 @@ Does nothing if savehist-mode is off."
(add-to-list 'savehist-minibuffer-history-variables
minibuffer-history-variable))
+;;; Turn on the mode.
+(savehist-mode 1)
+
(provide 'savehist)
;; arch-tag: b3ce47f4-c5ad-4ebc-ad02-73aba705cf9f