(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.
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
2005-11-14 Hrvoje Niksic <hniksic@xemacs.org>
|
||||
|
||||
* savehist.el (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.
|
||||
|
||||
2005-11-14 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* files.el (write-file): Refresh VC status.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
;; Author: Hrvoje Niksic <hniksic@xemacs.org>
|
||||
;; Keywords: minibuffer
|
||||
;; Version: 19
|
||||
;; Version: 23
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
@@ -64,9 +64,7 @@
|
||||
Set this by calling the `savehist-mode' function or using the customize
|
||||
interface."
|
||||
:type 'boolean
|
||||
:set (if (fboundp 'custom-set-minor-mode)
|
||||
'custom-set-minor-mode
|
||||
(lambda (symbol value) (funcall symbol (or value 0))))
|
||||
:set (lambda (symbol value) (savehist-mode (or value 0)))
|
||||
:initialize 'custom-initialize-default
|
||||
:require 'savehist
|
||||
:group 'savehist)
|
||||
@@ -135,12 +133,14 @@ You can use this hook to influence choice and content of variables to
|
||||
save."
|
||||
:type 'hook)
|
||||
|
||||
(defvar savehist-coding-system
|
||||
;; UTF-8 is usually preferable to ISO-2022-8 when available, but under
|
||||
;; XEmacs, UTF-8 is provided by external packages, and may not always be
|
||||
;; available, so even if it currently is available, we prefer not to
|
||||
;; use is.
|
||||
(if (featurep 'xemacs) 'iso-2022-8 'utf-8)
|
||||
;; This should be capable of representing characters used by Emacs.
|
||||
;; We prefer UTF-8 over ISO 2022 because it is well-known outside
|
||||
;; Mule. XEmacs prir to 21.5 had UTF-8 provided by an external
|
||||
;; package which may not be loaded, which is why we check for version.
|
||||
(defvar savehist-coding-system (if (and (featurep 'xemacs)
|
||||
(<= emacs-major-version 21)
|
||||
(< emacs-minor-version 5))
|
||||
'iso-2022-8 'utf-8)
|
||||
"The coding system savehist uses for saving the minibuffer history.
|
||||
Changing this value while Emacs is running is supported, but considered
|
||||
unwise, unless you know what you are doing.")
|
||||
@@ -157,21 +157,19 @@ The contents of this variable is built while Emacs is running, and saved
|
||||
along with minibuffer history. You can change its value off
|
||||
`savehist-save-hook' to influence which variables are saved.")
|
||||
|
||||
(defconst savehist-no-conversion (if (featurep 'xemacs) 'binary 'no-conversion)
|
||||
"Coding system without conversion, used for calculating internal checksums.
|
||||
Should be as fast as possible, ideally simply exposing the internal
|
||||
representation of buffer text.")
|
||||
;; Coding system without any conversion, used for calculating an
|
||||
;; internal checksum. Should be as fast as possible, ideally simply
|
||||
;; exposing the internal representation of buffer text.
|
||||
(defconst savehist-no-conversion (if (featurep 'xemacs) 'binary 'no-conversion))
|
||||
|
||||
(defvar savehist-loaded nil
|
||||
"Whether the history has already been loaded.
|
||||
This prevents toggling `savehist-mode' from destroying existing
|
||||
minibuffer history.")
|
||||
;; Whether the history has already been loaded. This prevents
|
||||
;; toggling savehist-mode from destroying existing minibuffer history.
|
||||
(defvar savehist-loaded nil)
|
||||
|
||||
(eval-when-compile
|
||||
(when (featurep 'xemacs)
|
||||
;; Must declare this under XEmacs, which doesn't have built-in
|
||||
;; minibuffer history truncation.
|
||||
(defvar history-length 100)))
|
||||
(when (featurep 'xemacs)
|
||||
;; Must declare this under XEmacs, which doesn't have built-in
|
||||
;; minibuffer history truncation.
|
||||
(defvar history-length 100))
|
||||
|
||||
;; Functions.
|
||||
|
||||
@@ -210,15 +208,6 @@ which is probably undesirable."
|
||||
(savehist-uninstall)
|
||||
(signal (car errvar) (cdr errvar)))))
|
||||
(savehist-install))
|
||||
|
||||
;; End with the usual minor-mode conventions normally provided
|
||||
;; transparently by define-minor-mode.
|
||||
(run-hooks 'savehist-mode-hook)
|
||||
(if (interactive-p)
|
||||
(progn
|
||||
(customize-mark-as-set 'savehist-mode)
|
||||
(unless (current-message)
|
||||
(message "Savehist mode %sabled" (if savehist-mode "en" "dis")))))
|
||||
;; Return the new setting.
|
||||
savehist-mode)
|
||||
(add-minor-mode 'savehist-mode "")
|
||||
@@ -373,8 +362,11 @@ Does nothing if savehist-mode is off."
|
||||
(error nil))))))
|
||||
|
||||
(defun savehist-minibuffer-hook ()
|
||||
(add-to-list 'savehist-minibuffer-history-variables
|
||||
minibuffer-history-variable))
|
||||
;; XEmacs sets minibuffer-history-variable to t to mean "no history
|
||||
;; is being recorded".
|
||||
(unless (eq minibuffer-history-variable t)
|
||||
(add-to-list 'savehist-minibuffer-history-variables
|
||||
minibuffer-history-variable)))
|
||||
|
||||
(provide 'savehist)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user