aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/misc/cl.texi15
-rw-r--r--lisp/emacs-lisp/cl-lib.el15
-rw-r--r--lisp/emacs-lisp/cl-macs.el2
3 files changed, 9 insertions, 23 deletions
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index d7b3f4a0a68..1f38ca98c62 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -2877,14 +2877,8 @@ their names will not conflict with ``real'' variables in the user's
2877code. 2877code.
2878 2878
2879(Internally, the variable @code{cl--gensym-counter} holds the counter 2879(Internally, the variable @code{cl--gensym-counter} holds the counter
2880used to generate names. It is incremented after each use. In Common 2880used to generate names. It is initialized with zero and incremented
2881Lisp this is initialized with 0, but this package initializes it with 2881after each use.)
2882a random time-dependent value to avoid trouble when two files that
2883each used @code{cl-gensym} in their compilation are loaded together.
2884Uninterned symbols become interned when the compiler writes them out
2885to a file and the Emacs loader loads them, so their names have to be
2886treated a bit more carefully than in Common Lisp where uninterned
2887symbols remain uninterned after loading.)
2888@end defun 2882@end defun
2889 2883
2890@defun cl-gentemp &optional x 2884@defun cl-gentemp &optional x
@@ -4543,10 +4537,7 @@ example, local @code{special} declarations, which are purely
4543advisory in Emacs Lisp, do not rigorously obey the scoping rules 4537advisory in Emacs Lisp, do not rigorously obey the scoping rules
4544set down in Steele's book. 4538set down in Steele's book.
4545 4539
4546The variable @code{cl--gensym-counter} starts out with a pseudo-random 4540The variable @code{cl--gensym-counter} starts out with zero.
4547value rather than with zero. This is to cope with the fact that
4548generated symbols become interned when they are written to and
4549loaded back from a file.
4550 4541
4551The @code{cl-defstruct} facility is compatible, except that structures 4542The @code{cl-defstruct} facility is compatible, except that structures
4552are of type @code{:type vector :named} by default rather than some 4543are of type @code{:type vector :named} by default rather than some
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.