Nuke arch-tags.
[bpt/emacs.git] / lisp / emacs-lisp / cl.el
index 8d60950..c01c6f1 100644 (file)
@@ -1,7 +1,7 @@
-;;; cl.el --- Common Lisp extensions for Emacs -*-byte-compile-dynamic: t;-*-
+;;; cl.el --- Common Lisp extensions for Emacs
 
-;; Copyright (C) 1993, 2001, 2002, 2003, 2004, 2005,
-;;   2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+;;   2009, 2010, 2011  Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Version: 2.02
@@ -9,10 +9,10 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +20,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -109,9 +107,11 @@ printer proceeds to the next function on the list.
 This variable is not used at present, but it is defined in hopes that
 a future Emacs interpreter will be able to use it.")
 
-(add-hook 'cl-unload-hook 'cl-cannot-unload)
-(defun cl-cannot-unload ()
-  (error "Cannot unload the feature `cl'"))
+(defun cl-unload-function ()
+  "Stop unloading of the Common Lisp extensions."
+  (message "Cannot unload the feature `cl'")
+  ;; stop standard unloading!
+  t)
 
 ;;; Generalized variables.
 ;; These macros are defined here so that they
@@ -133,6 +133,9 @@ The return value is the decremented value of PLACE."
       (list 'setq place (if x (list '- place x) (list '1- place)))
     (list 'callf '- place (or x 1))))
 
+;; Autoloaded, but we haven't loaded cl-loaddefs yet.
+(declare-function cl-do-pop "cl-macs" (place))
+
 (defmacro pop (place)
   "Remove and return the head of the list stored in PLACE.
 Analogous to (prog1 (car PLACE) (setf PLACE (cdr PLACE))), though more
@@ -166,7 +169,7 @@ an element already on the list.
 (defun cl-set-elt (seq n val)
   (if (listp seq) (setcar (nthcdr n seq) val) (aset seq n val)))
 
-(defun cl-set-nthcdr (n list x)
+(defsubst cl-set-nthcdr (n list x)
   (if (<= n 0) x (setcdr (nthcdr (1- n) list) x) list))
 
 (defun cl-set-buffer-substring (start end val)
@@ -243,7 +246,7 @@ one value."
 
 ;;; Macros.
 
-(defvar cl-macro-environment nil)
+(defvar cl-macro-environment)
 (defvar cl-old-macroexpand (prog1 (symbol-function 'macroexpand)
                             (defalias 'macroexpand 'cl-macroexpand)))
 
@@ -269,8 +272,9 @@ definitions to shadow the loaded ones for use in file byte-compilation.
 (defvar cl-compiling-file nil)
 (defun cl-compiling-file ()
   (or cl-compiling-file
-      (and (boundp 'outbuffer) (bufferp (symbol-value 'outbuffer))
-          (equal (buffer-name (symbol-value 'outbuffer))
+      (and (boundp 'bytecomp-outbuffer)
+           (bufferp (symbol-value 'bytecomp-outbuffer))
+          (equal (buffer-name (symbol-value 'bytecomp-outbuffer))
                  " *Compiler Output*"))))
 
 (defvar cl-proclaims-deferred nil)
@@ -338,6 +342,8 @@ always returns nil."
 
 (defalias 'copy-seq 'copy-sequence)
 
+(declare-function cl-mapcar-many "cl-extra" (cl-func cl-seqs))
+
 (defun mapcar* (cl-func cl-x &rest cl-rest)
   "Apply FUNCTION to each element of SEQ, and make a list of the results.
 If there are several SEQs, FUNCTION is called with that many arguments,
@@ -536,6 +542,14 @@ The elements of LIST are not copied, just the list structure itself."
   list)
 
 (defalias 'cl-member 'memq)   ; for compatibility with old CL package
+
+;; Autoloaded, but we have not loaded cl-loaddefs yet.
+(declare-function floor* "cl-extra" (x &optional y))
+(declare-function ceiling* "cl-extra" (x &optional y))
+(declare-function truncate* "cl-extra" (x &optional y))
+(declare-function round* "cl-extra" (x &optional y))
+(declare-function mod* "cl-extra" (x y))
+
 (defalias 'cl-floor 'floor*)
 (defalias 'cl-ceiling 'ceiling*)
 (defalias 'cl-truncate 'truncate*)
@@ -631,18 +645,17 @@ If ALIST is non-nil, the new pairs are prepended to it."
 (load "cl-loaddefs" nil 'quiet)
 
 ;; This goes here so that cl-macs can find it if it loads right now.
-(provide 'cl-19)     ; usage: (require 'cl-19 "cl")
+(provide 'cl)
 
 ;; Things to do after byte-compiler is loaded.
-;; As a side effect, we cause cl-macs to be loaded when compiling, so
-;; that the compiler-macros defined there will be present.
 
 (defvar cl-hacked-flag nil)
 (defun cl-hack-byte-compiler ()
-  (if (and (not cl-hacked-flag) (fboundp 'byte-compile-file-form))
-      (progn
-       (setq cl-hacked-flag t)         ; Do it first, to prevent recursion.
-       (cl-compile-time-init))))       ; In cl-macs.el.
+  (and (not cl-hacked-flag) (fboundp 'byte-compile-file-form)
+       (progn
+         (setq cl-hacked-flag t)  ; Do it first, to prevent recursion.
+         (load "cl-macs" nil t)
+         (run-hooks 'cl-hack-bytecomp-hook))))
 
 ;; Try it now in case the compiler has already been loaded.
 (cl-hack-byte-compiler)
@@ -658,5 +671,9 @@ If ALIST is non-nil, the new pairs are prepended to it."
 
 (run-hooks 'cl-load-hook)
 
-;; arch-tag: 5f07fa74-f153-4524-9303-21f5be125851
+;; Local variables:
+;; byte-compile-dynamic: t
+;; byte-compile-warnings: (not cl-functions)
+;; End:
+
 ;;; cl.el ends here