aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-11-14 22:30:35 +0000
committerStefan Monnier2005-11-14 22:30:35 +0000
commit2d10b62be6e272ceefdfa7d4516f0d8a73781c47 (patch)
tree82d3034485c54f8591a27b74fdbf49c46e1b0e57
parent8e5c7b90ee28002fa6b4b860d3c69719f865f19a (diff)
downloademacs-2d10b62be6e272ceefdfa7d4516f0d8a73781c47.tar.gz
emacs-2d10b62be6e272ceefdfa7d4516f0d8a73781c47.zip
(savehist-mode): Don't bother with `custom-set-minor-mode.
(savehist-coding-system): Check XEmacs version. (history-length): Declare also at run time. (savehist-mode): Don't emit a message. Don't run the minor mode hook. Don't set the customize state. (savehist-minibuffer-hook): Special case for when minibuffer-history-variable is equal to t.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/savehist.el60
2 files changed, 36 insertions, 34 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0fc0586b8f5..fd74d80c848 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12005-11-14 Hrvoje Niksic <hniksic@xemacs.org>
2
3 * savehist.el (savehist-mode): Don't bother with `custom-set-minor-mode.
4 (savehist-coding-system): Check XEmacs version.
5 (history-length): Declare also at run time.
6 (savehist-mode): Don't emit a message. Don't run the minor mode hook.
7 Don't set the customize state.
8 (savehist-minibuffer-hook): Special case for when
9 minibuffer-history-variable is equal to t.
10
12005-11-14 Stefan Monnier <monnier@iro.umontreal.ca> 112005-11-14 Stefan Monnier <monnier@iro.umontreal.ca>
2 12
3 * files.el (write-file): Refresh VC status. 13 * files.el (write-file): Refresh VC status.
diff --git a/lisp/savehist.el b/lisp/savehist.el
index 6c85fb7c635..b9b0c54aca0 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: 19 7;; Version: 23
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10 10
@@ -64,9 +64,7 @@
64Set this by calling the `savehist-mode' function or using the customize 64Set this by calling the `savehist-mode' function or using the customize
65interface." 65interface."
66 :type 'boolean 66 :type 'boolean
67 :set (if (fboundp 'custom-set-minor-mode) 67 :set (lambda (symbol value) (savehist-mode (or value 0)))
68 'custom-set-minor-mode
69 (lambda (symbol value) (funcall symbol (or value 0))))
70 :initialize 'custom-initialize-default 68 :initialize 'custom-initialize-default
71 :require 'savehist 69 :require 'savehist
72 :group 'savehist) 70 :group 'savehist)
@@ -135,12 +133,14 @@ You can use this hook to influence choice and content of variables to
135save." 133save."
136 :type 'hook) 134 :type 'hook)
137 135
138(defvar savehist-coding-system 136;; This should be capable of representing characters used by Emacs.
139 ;; UTF-8 is usually preferable to ISO-2022-8 when available, but under 137;; We prefer UTF-8 over ISO 2022 because it is well-known outside
140 ;; XEmacs, UTF-8 is provided by external packages, and may not always be 138;; Mule. XEmacs prir to 21.5 had UTF-8 provided by an external
141 ;; available, so even if it currently is available, we prefer not to 139;; package which may not be loaded, which is why we check for version.
142 ;; use is. 140(defvar savehist-coding-system (if (and (featurep 'xemacs)
143 (if (featurep 'xemacs) 'iso-2022-8 'utf-8) 141 (<= emacs-major-version 21)
142 (< emacs-minor-version 5))
143 'iso-2022-8 'utf-8)
144 "The coding system savehist uses for saving the minibuffer history. 144 "The coding system savehist uses for saving the minibuffer history.
145Changing this value while Emacs is running is supported, but considered 145Changing this value while Emacs is running is supported, but considered
146unwise, unless you know what you are doing.") 146unwise, unless you know what you are doing.")
@@ -157,21 +157,19 @@ The contents of this variable is built while Emacs is running, and saved
157along with minibuffer history. You can change its value off 157along with minibuffer history. You can change its value off
158`savehist-save-hook' to influence which variables are saved.") 158`savehist-save-hook' to influence which variables are saved.")
159 159
160(defconst savehist-no-conversion (if (featurep 'xemacs) 'binary 'no-conversion) 160;; Coding system without any conversion, used for calculating an
161 "Coding system without conversion, used for calculating internal checksums. 161;; internal checksum. Should be as fast as possible, ideally simply
162Should be as fast as possible, ideally simply exposing the internal 162;; exposing the internal representation of buffer text.
163representation of buffer text.") 163(defconst savehist-no-conversion (if (featurep 'xemacs) 'binary 'no-conversion))
164 164
165(defvar savehist-loaded nil 165;; Whether the history has already been loaded. This prevents
166 "Whether the history has already been loaded. 166;; toggling savehist-mode from destroying existing minibuffer history.
167This prevents toggling `savehist-mode' from destroying existing 167(defvar savehist-loaded nil)
168minibuffer history.")
169 168
170(eval-when-compile 169(when (featurep 'xemacs)
171 (when (featurep 'xemacs) 170 ;; Must declare this under XEmacs, which doesn't have built-in
172 ;; Must declare this under XEmacs, which doesn't have built-in 171 ;; minibuffer history truncation.
173 ;; minibuffer history truncation. 172 (defvar history-length 100))
174 (defvar history-length 100)))
175 173
176;; Functions. 174;; Functions.
177 175
@@ -210,15 +208,6 @@ which is probably undesirable."
210 (savehist-uninstall) 208 (savehist-uninstall)
211 (signal (car errvar) (cdr errvar))))) 209 (signal (car errvar) (cdr errvar)))))
212 (savehist-install)) 210 (savehist-install))
213
214 ;; End with the usual minor-mode conventions normally provided
215 ;; transparently by define-minor-mode.
216 (run-hooks 'savehist-mode-hook)
217 (if (interactive-p)
218 (progn
219 (customize-mark-as-set 'savehist-mode)
220 (unless (current-message)
221 (message "Savehist mode %sabled" (if savehist-mode "en" "dis")))))
222 ;; Return the new setting. 211 ;; Return the new setting.
223 savehist-mode) 212 savehist-mode)
224(add-minor-mode 'savehist-mode "") 213(add-minor-mode 'savehist-mode "")
@@ -373,8 +362,11 @@ Does nothing if savehist-mode is off."
373 (error nil)))))) 362 (error nil))))))
374 363
375(defun savehist-minibuffer-hook () 364(defun savehist-minibuffer-hook ()
376 (add-to-list 'savehist-minibuffer-history-variables 365 ;; XEmacs sets minibuffer-history-variable to t to mean "no history
377 minibuffer-history-variable)) 366 ;; is being recorded".
367 (unless (eq minibuffer-history-variable t)
368 (add-to-list 'savehist-minibuffer-history-variables
369 minibuffer-history-variable)))
378 370
379(provide 'savehist) 371(provide 'savehist)
380 372