Merge from emacs-24; up to 2012-11-15T23:31:37Z!dancol@dancol.org
[bpt/emacs.git] / lisp / emacs-lisp / cl-lib.el
index 532c81c..d5e5f4b 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1993, 2001-2012  Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
-;; Version: 2.02
+;; Version: 1.0
 ;; Keywords: extensions
 
 ;; This file is part of GNU Emacs.
@@ -121,7 +121,7 @@ a future Emacs interpreter will be able to use it.")
 
 ;;; Generalized variables.
 ;; These macros are defined here so that they
-;; can safely be used in .emacs files.
+;; can safely be used in init files.
 
 (defmacro cl-incf (place &optional x)
   "Increment PLACE by X (1 by default).
@@ -251,12 +251,17 @@ one value.
 (defvar cl-proclaims-deferred nil)
 
 (defun cl-proclaim (spec)
+  "Record a global declaration specified by SPEC."
   (if (fboundp 'cl-do-proclaim) (cl-do-proclaim spec t)
     (push spec cl-proclaims-deferred))
   nil)
 
 (defmacro cl-declaim (&rest specs)
-  (let ((body (mapcar (function (lambda (x) (list 'cl-proclaim (list 'quote x))))
+  "Like `cl-proclaim', but takes any number of unevaluated, unquoted arguments.
+Puts `(cl-eval-when (compile load eval) ...)' around the declarations
+so that they are registered at compile-time as well as run-time."
+  (let ((body (mapcar (function (lambda (x)
+                                  (list 'cl-proclaim (list 'quote x))))
                      specs)))
     (if (cl--compiling-file) (cl-list* 'cl-eval-when '(compile load eval) body)
       (cons 'progn body))))   ; avoid loading cl-macs.el for cl-eval-when
@@ -264,12 +269,12 @@ one value.
 
 ;;; Symbols.
 
-(defun cl-random-time ()
+(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))
+(defvar cl--gensym-counter (* (logand (cl--random-time) 1023) 100))
 
 
 ;;; Numbers.
@@ -296,7 +301,7 @@ always returns nil."
   "Return t if INTEGER is even."
   (eq (logand integer 1) 0))
 
-(defvar cl--random-state (vector 'cl-random-state-tag -1 30 (cl-random-time)))
+(defvar cl--random-state (vector 'cl-random-state-tag -1 30 (cl--random-time)))
 
 (defconst cl-most-positive-float nil
   "The largest value that a Lisp float can hold.
@@ -656,7 +661,7 @@ If ALIST is non-nil, the new pairs are prepended to it."
 (gv-define-setter face-foreground (x f &optional s)
   `(set-face-foreground ,f ,x ,s))
 (gv-define-setter face-underline-p (x f &optional s)
-  `(set-face-underline-p ,f ,x ,s))
+  `(set-face-underline ,f ,x ,s))
 (gv-define-simple-setter file-modes set-file-modes t)
 (gv-define-simple-setter frame-height set-screen-height t)
 (gv-define-simple-setter frame-parameters modify-frame-parameters t)
@@ -728,7 +733,8 @@ If ALIST is non-nil, the new pairs are prepended to it."
 ;;;###autoload
 (progn
   ;; Make sure functions defined with cl-defsubst can be inlined even in
-  ;; packages which do not require CL.
+  ;; packages which do not require CL.  We don't put an autoload cookie
+  ;; directly on that function, since those cookies only go to cl-loaddefs.
   (autoload 'cl--defsubst-expand "cl-macs")
   ;; Autoload, so autoload.el and font-lock can use it even when CL
   ;; is not loaded.
@@ -745,7 +751,6 @@ If ALIST is non-nil, the new pairs are prepended to it."
 
 ;; Local variables:
 ;; byte-compile-dynamic: t
-;; byte-compile-warnings: (not cl-functions)
 ;; End:
 
 ;;; cl-lib.el ends here