diff options
| author | Stefan Monnier | 2005-10-16 15:22:37 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-10-16 15:22:37 +0000 |
| commit | 3930b7e41545491693fdf227cce5fff370f27636 (patch) | |
| tree | 35ecaa67aa5a13229bcecc51d9b7b884f67ff0bd | |
| parent | 216ee1a46ca96744c6d344ee682fcae18d5aa1fc (diff) | |
| download | emacs-3930b7e41545491693fdf227cce5fff370f27636.tar.gz emacs-3930b7e41545491693fdf227cce5fff370f27636.zip | |
Don't require CL at runtime.
(savehist-xemacs): Remove.
(savehist-coding-system): Use utf-8 if available, regardless of religion.
(savehist-no-conversion): Use (featurep 'xemacs).
(savehist-load): Check existence of start-itimer rather than XEmacs.
Use an idle timer.
(savehist-process-for-saving): Replace use of CL funs `subseq' and
`delete-if-not'.
| -rw-r--r-- | lisp/savehist.el | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lisp/savehist.el b/lisp/savehist.el index 67c7a576b83..b6c05393e73 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el | |||
| @@ -45,7 +45,6 @@ | |||
| 45 | ;;; Code: | 45 | ;;; Code: |
| 46 | 46 | ||
| 47 | (require 'custom) | 47 | (require 'custom) |
| 48 | (require 'cl) | ||
| 49 | 48 | ||
| 50 | ;; User variables | 49 | ;; User variables |
| 51 | 50 | ||
| @@ -139,9 +138,7 @@ the user's privacy." | |||
| 139 | :type 'integer | 138 | :type 'integer |
| 140 | :group 'savehist) | 139 | :group 'savehist) |
| 141 | 140 | ||
| 142 | (defconst savehist-xemacs (string-match "XEmacs" emacs-version)) | 141 | (defvar savehist-coding-system (if (coding-system-p 'utf-8) 'utf-8 'iso-2022-8) |
| 143 | |||
| 144 | (defvar savehist-coding-system (if savehist-xemacs 'iso-2022-8 'utf-8) | ||
| 145 | "The coding system savehist uses for saving the minibuffer history. | 142 | "The coding system savehist uses for saving the minibuffer history. |
| 146 | Changing this value while Emacs is running is supported, but considered | 143 | Changing this value while Emacs is running is supported, but considered |
| 147 | unwise, unless you know what you are doing.") | 144 | unwise, unless you know what you are doing.") |
| @@ -152,9 +149,9 @@ unwise, unless you know what you are doing.") | |||
| 152 | 149 | ||
| 153 | (defvar savehist-last-checksum nil) | 150 | (defvar savehist-last-checksum nil) |
| 154 | 151 | ||
| 155 | ;; Coding system without conversion, only used for calculating and | 152 | (defconst savehist-no-conversion (if (featurep 'xemacs) 'binary 'no-conversion) |
| 156 | ;; comparing checksums. | 153 | ;; FIXME: Why not use savehist-coding-system? |
| 157 | (defconst savehist-no-conversion (if savehist-xemacs 'binary 'no-conversion)) | 154 | "Coding system without conversion, only used for calculating checksums.") |
| 158 | 155 | ||
| 159 | ;; Functions | 156 | ;; Functions |
| 160 | 157 | ||
| @@ -176,12 +173,12 @@ other time." | |||
| 176 | ;; executes in under 5 ms on my system. | 173 | ;; executes in under 5 ms on my system. |
| 177 | (unless savehist-timer | 174 | (unless savehist-timer |
| 178 | (setq savehist-timer | 175 | (setq savehist-timer |
| 179 | (if savehist-xemacs | 176 | (if (fboundp 'start-itimer) |
| 180 | (start-itimer | 177 | (start-itimer |
| 181 | "savehist" 'savehist-autosave savehist-autosave-interval | 178 | "savehist" 'savehist-autosave savehist-autosave-interval |
| 182 | savehist-autosave-interval) | 179 | savehist-autosave-interval) |
| 183 | (run-with-timer savehist-autosave-interval savehist-autosave-interval | 180 | (run-with-idle-timer savehist-autosave-interval savehist-autosave-interval |
| 184 | 'savehist-autosave))))) | 181 | 'savehist-autosave))))) |
| 185 | ;; Don't set coding-system-for-read here. We rely on autodetection | 182 | ;; Don't set coding-system-for-read here. We rely on autodetection |
| 186 | ;; and the coding cookie to convey that information. That way, if | 183 | ;; and the coding cookie to convey that information. That way, if |
| 187 | ;; the user changes the value of savehist-coding-system, we can | 184 | ;; the user changes the value of savehist-coding-system, we can |
| @@ -237,13 +234,14 @@ If AUTO-SAVE is non-nil, compare the saved contents to the one last saved, | |||
| 237 | (cond | 234 | (cond |
| 238 | ((listp value) | 235 | ((listp value) |
| 239 | (when (and savehist-length (> (length value) savehist-length)) | 236 | (when (and savehist-length (> (length value) savehist-length)) |
| 240 | (setq value (subseq value 0 savehist-length))) | 237 | (setq value (copy-sequence value)) |
| 241 | (delete-if-not #'savehist-printable value)) | 238 | (setcdr (nthcdr savehist-length value) nil)) |
| 239 | (delq nil (mapcar (lambda (x) (if (savehist-printable x) x)) value))) | ||
| 242 | ((savehist-printable value) value) | 240 | ((savehist-printable value) value) |
| 243 | (t nil))) | 241 | (t nil))) |
| 244 | 242 | ||
| 245 | (defun savehist-printable (value) | 243 | (defun savehist-printable (value) |
| 246 | "Returns non-nil if VALUE is printable." | 244 | "Return non-nil if VALUE is printable." |
| 247 | ;; Quick response for oft-encountered types known to be printable. | 245 | ;; Quick response for oft-encountered types known to be printable. |
| 248 | (cond | 246 | (cond |
| 249 | ((stringp value)) | 247 | ((stringp value)) |