diff options
| author | Paul Eggert | 2015-06-27 10:57:02 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-06-27 10:59:08 -0700 |
| commit | efc262f5f8a16d25c0db4e80fa52e693897fa41f (patch) | |
| tree | 6a78ad9a601676202619bbf50eccff61f2936e83 /lisp | |
| parent | 5e3fde03b45877d3e30f859a14c10043e637aa63 (diff) | |
| download | emacs-efc262f5f8a16d25c0db4e80fa52e693897fa41f.tar.gz emacs-efc262f5f8a16d25c0db4e80fa52e693897fa41f.zip | |
Initialize cl--gensym-counter to 0
Previously it was initialized to a random value, which made it
harder to reproduce earlier Emacs runs. The need for a random
value went away when Emacs introduced and used the #: syntax for
uninterned symbols (Bug#20862).
* doc/misc/cl.texi (Creating Symbols, Common Lisp Compatibility):
Document that cl--gensym-counter now starts with 0.
* lisp/emacs-lisp/cl-lib.el (cl--gensym-counter): Remove.
(cl--random-time): Move to near only remaining use.
* lisp/emacs-lisp/cl-macs.el (cl--gensym-counter): Initialize to 0.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/cl-lib.el | 15 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 2 |
2 files changed, 6 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index b6f3a793be6..2dd05192019 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el | |||
| @@ -249,16 +249,6 @@ so that they are registered at compile-time as well as run-time." | |||
| 249 | `(progn ,@body)))) ; Avoid loading cl-macs.el for cl-eval-when. | 249 | `(progn ,@body)))) ; Avoid loading cl-macs.el for cl-eval-when. |
| 250 | 250 | ||
| 251 | 251 | ||
| 252 | ;;; Symbols. | ||
| 253 | |||
| 254 | (defun cl--random-time () | ||
| 255 | (let* ((time (copy-sequence (current-time-string))) (i (length time)) (v 0)) | ||
| 256 | (while (>= (cl-decf i) 0) (setq v (+ (* v 3) (aref time i)))) | ||
| 257 | v)) | ||
| 258 | |||
| 259 | (defvar cl--gensym-counter (* (logand (cl--random-time) 1023) 100)) | ||
| 260 | |||
| 261 | |||
| 262 | ;;; Numbers. | 252 | ;;; Numbers. |
| 263 | 253 | ||
| 264 | (define-obsolete-function-alias 'cl-floatp-safe 'floatp "24.4") | 254 | (define-obsolete-function-alias 'cl-floatp-safe 'floatp "24.4") |
| @@ -298,6 +288,11 @@ If true return the decimal value of digit CHAR in RADIX." | |||
| 298 | (let ((n (aref cl-digit-char-table char))) | 288 | (let ((n (aref cl-digit-char-table char))) |
| 299 | (and n (< n (or radix 10)) n))) | 289 | (and n (< n (or radix 10)) n))) |
| 300 | 290 | ||
| 291 | (defun cl--random-time () | ||
| 292 | (let* ((time (copy-sequence (current-time-string))) (i (length time)) (v 0)) | ||
| 293 | (while (>= (cl-decf i) 0) (setq v (+ (* v 3) (aref time i)))) | ||
| 294 | v)) | ||
| 295 | |||
| 301 | (defvar cl--random-state | 296 | (defvar cl--random-state |
| 302 | (vector 'cl--random-state-tag -1 30 (cl--random-time))) | 297 | (vector 'cl--random-state-tag -1 30 (cl--random-time))) |
| 303 | 298 | ||
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 636c5433a97..5bcf0882791 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -161,7 +161,7 @@ whether X is known at compile time, macroexpand it completely in | |||
| 161 | 161 | ||
| 162 | ;;; Symbols. | 162 | ;;; Symbols. |
| 163 | 163 | ||
| 164 | (defvar cl--gensym-counter) | 164 | (defvar cl--gensym-counter 0) |
| 165 | ;;;###autoload | 165 | ;;;###autoload |
| 166 | (defun cl-gensym (&optional prefix) | 166 | (defun cl-gensym (&optional prefix) |
| 167 | "Generate a new uninterned symbol. | 167 | "Generate a new uninterned symbol. |