aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-11-16 17:20:25 +0000
committerStefan Monnier2005-11-16 17:20:25 +0000
commited5a258ad1d3be05d678568edfb68a6ff0bd6ebd (patch)
tree9175c3054b0d04f4c844dd65986eb659ff91781c
parentcbad4a9ef815832eae5bf4a10e61eb52d1e681f4 (diff)
downloademacs-ed5a258ad1d3be05d678568edfb68a6ff0bd6ebd.tar.gz
emacs-ed5a258ad1d3be05d678568edfb68a6ff0bd6ebd.zip
(savehist-mode-hook): Re-add the var.
(savehist-mode): Use it.
-rw-r--r--lisp/savehist.el31
1 files changed, 19 insertions, 12 deletions
diff --git a/lisp/savehist.el b/lisp/savehist.el
index b9b0c54aca0..f8c39a31cb5 100644
--- a/lisp/savehist.el
+++ b/lisp/savehist.el
@@ -4,7 +4,7 @@
4 4
5;; Author: Hrvoje Niksic <hniksic@xemacs.org> 5;; Author: Hrvoje Niksic <hniksic@xemacs.org>
6;; Keywords: minibuffer 6;; Keywords: minibuffer
7;; Version: 23 7;; Version: 24
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10 10
@@ -127,6 +127,10 @@ If set to nil, disables timer-based autosaving."
127 :type 'integer 127 :type 'integer
128 :group 'savehist) 128 :group 'savehist)
129 129
130(defcustom savehist-mode-hook nil
131 "Hook called when `savehist-mode' is turned on."
132 :type 'hook)
133
130(defcustom savehist-save-hook nil 134(defcustom savehist-save-hook nil
131 "Hook called by `savehist-save' before saving the variables. 135 "Hook called by `savehist-save' before saving the variables.
132You can use this hook to influence choice and content of variables to 136You can use this hook to influence choice and content of variables to
@@ -157,14 +161,16 @@ The contents of this variable is built while Emacs is running, and saved
157along with minibuffer history. You can change its value off 161along with minibuffer history. You can change its value off
158`savehist-save-hook' to influence which variables are saved.") 162`savehist-save-hook' to influence which variables are saved.")
159 163
160;; Coding system without any conversion, used for calculating an 164(defconst savehist-no-conversion (if (featurep 'xemacs) 'binary 'no-conversion)
161;; internal checksum. Should be as fast as possible, ideally simply 165 "Coding system without any conversion.
162;; exposing the internal representation of buffer text. 166This is used for calculating an internal checksum. Should be as fast
163(defconst savehist-no-conversion (if (featurep 'xemacs) 'binary 'no-conversion)) 167as possible, ideally simply exposing the internal representation of
168buffer text.")
164 169
165;; Whether the history has already been loaded. This prevents 170(defvar savehist-loaded nil
166;; toggling savehist-mode from destroying existing minibuffer history. 171 "Whether the history has already been loaded.
167(defvar savehist-loaded nil) 172This prevents toggling savehist-mode from destroying existing
173minibuffer history.")
168 174
169(when (featurep 'xemacs) 175(when (featurep 'xemacs)
170 ;; Must declare this under XEmacs, which doesn't have built-in 176 ;; Must declare this under XEmacs, which doesn't have built-in
@@ -207,7 +213,8 @@ which is probably undesirable."
207 (setq savehist-mode nil) 213 (setq savehist-mode nil)
208 (savehist-uninstall) 214 (savehist-uninstall)
209 (signal (car errvar) (cdr errvar))))) 215 (signal (car errvar) (cdr errvar)))))
210 (savehist-install)) 216 (savehist-install)
217 (run-hooks 'savehist-mode-hook))
211 ;; Return the new setting. 218 ;; Return the new setting.
212 savehist-mode) 219 savehist-mode)
213(add-minor-mode 'savehist-mode "") 220(add-minor-mode 'savehist-mode "")
@@ -329,9 +336,9 @@ Does nothing if savehist-mode is off."
329 (savehist-save t))) 336 (savehist-save t)))
330 337
331(defun savehist-trim-history (value) 338(defun savehist-trim-history (value)
332 ;; Retain only the first history-length items in VALUE. Only used 339 "Retain only the first history-length items in VALUE.
333 ;; under XEmacs, which doesn't (yet) implement automatic trimming of 340Only used under XEmacs, which doesn't (yet) implement automatic
334 ;; history lists to history-length items. 341trimming of history lists to history-length items."
335 (if (and (featurep 'xemacs) 342 (if (and (featurep 'xemacs)
336 (natnump history-length) 343 (natnump history-length)
337 (> (length value) history-length)) 344 (> (length value) history-length))