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.
This commit is contained in:
Paul Eggert 2015-06-27 10:57:02 -07:00
parent 5e3fde03b4
commit efc262f5f8
3 changed files with 9 additions and 23 deletions

View file

@ -249,16 +249,6 @@ so that they are registered at compile-time as well as run-time."
`(progn ,@body)))) ; Avoid loading cl-macs.el for cl-eval-when.
;;; Symbols.
(defun cl--random-time ()
(let* ((time (copy-sequence (current-time-string))) (i (length time)) (v 0))
(while (>= (cl-decf i) 0) (setq v (+ (* v 3) (aref time i))))
v))
(defvar cl--gensym-counter (* (logand (cl--random-time) 1023) 100))
;;; Numbers.
(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."
(let ((n (aref cl-digit-char-table char)))
(and n (< n (or radix 10)) n)))
(defun cl--random-time ()
(let* ((time (copy-sequence (current-time-string))) (i (length time)) (v 0))
(while (>= (cl-decf i) 0) (setq v (+ (* v 3) (aref time i))))
v))
(defvar cl--random-state
(vector 'cl--random-state-tag -1 30 (cl--random-time)))