diff lisp/cl-extra.el @ 5632:bd80d9103fc8

Integrate CL code better into core, remove obsolete compatibility code. lisp/ChangeLog addition: 2011-12-30 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el: Call #'cl-compile-time-init explicitly here, don't rely on bytecomp-load-hook for what is core functionality. * cl-extra.el: * cl-extra.el (require): * cl-extra.el (make-random-state): * cl-extra.el (random-state-p): * cl-extra.el (make-hashtable): Removed. * cl-extra.el (make-weak-hashtable): Removed. * cl-extra.el (make-key-weak-hashtable): Removed. * cl-extra.el (make-value-weak-hashtable): Removed. * cl-extra.el ('hashtablep): Removed. * cl-extra.el ('hashtable-fullness): Removed. * cl-extra.el ('hashtable-test-function): Removed. * cl-extra.el ('hashtable-type): Removed. * cl-extra.el ('hashtable-size): Removed. * cl-extra.el ('copy-hashtable): Removed. * cl-extra.el (cl-builtin-gethash): Removed. * cl-extra.el (cl-builtin-remhash): Removed. * cl-extra.el (cl-builtin-clrhash): Removed. * cl-extra.el (cl-builtin-maphash): Removed. * cl-extra.el ('cl-gethash): Removed. * cl-extra.el ('cl-puthash): Removed. * cl-extra.el ('cl-remhash): Removed. * cl-extra.el ('cl-clrhash): Removed. * cl-extra.el ('cl-maphash): Removed. * cl-extra.el ('cl-make-hash-table): Removed. * cl-extra.el ('cl-hash-table-p): Removed. * cl-extra.el ('cl-hash-table-count): Removed. * cl-extra.el (cl-prettyexpand): * cl-extra.el (names): Remove compatibility aliases from this file. In #'cl-prettyexpand, if FULL is nil, don't expand return-from either, for symmetry with not expanding block. Drop cl-extra-load-hook, it's useless when cl-extra is dumped (since third-party code can't use it, and dumped code shouldn't use it.) * cl-macs.el: * cl-macs.el (cl-pop2): * cl-macs.el (defun*): * cl-macs.el (cl-parse-loop-clause): Remove some no-longer-needed compatibility kludges. * cl.el: * cl.el ('cl-map-extents): Removed. * cl.el (cl-random-time): * cl.el (list*): New, moved back from subr.el, given a shorter implementation. * cl.el ('cl-member): Removed. * cl.el ('cl-floor): Removed. * cl.el ('cl-ceiling): Removed. * cl.el ('cl-truncate): Removed. * cl.el ('cl-round): Removed. * cl.el ('cl-mod): Removed. Remove some compatibility aliases; these may conflict with package usage, in which case the packages need to be updated, the new names are available in 21.4, and that's the most recent version we support. * cl.el (cl-hacked-flag): Removed. * cl.el (cl-hack-byte-compiler): Removed. * subr.el: * subr.el (list*): Moved back to cl.el. * update-elc-2.el (batch-update-elc-2): * update-elc.el (do-autoload-commands): Add an autoload for cl-compile-time-init in these two files, they run on bare temacs, auto-autoload isn't available to them, and now bytecomp calls cl-compile-time-init explicitly. * cl-compat.el: Removed. This file was long obsolete. man/ChangeLog addition: 2011-12-30 Aidan Kehoe <kehoea@parhasard.net> * cl.texi (Top): * cl.texi (Usage): * cl.texi (Organization): * cl.texi (Efficiency Concerns): * cl.texi (Common Lisp Compatibility): Remove documentation of cl-compat, now it's deleted.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 30 Dec 2011 16:05:31 +0000
parents 10f179710250
children e9c3fe82127d
line wrap: on
line diff
--- a/lisp/cl-extra.el	Fri Dec 30 13:55:07 2011 +0000
+++ b/lisp/cl-extra.el	Fri Dec 30 16:05:31 2011 +0000
@@ -46,8 +46,7 @@
 
 ;;; Code:
 ;; XEmacs addition
-(eval-when-compile
-  (require 'obsolete))
+(eval-when-compile (require 'obsolete))
 
 ;;; Type coercion.
 
@@ -354,13 +353,13 @@
   "Return a copy of random-state STATE, or of `*random-state*' if omitted.
 If STATE is t, return a new state object seeded from the time of day."
   (cond ((null state) (make-random-state *random-state*))
-	((vectorp state) (cl-copy-tree state t))
+	((vectorp state) (copy-tree state t))
 	((integerp state) (vector 'cl-random-state-tag -1 30 state))
 	(t (make-random-state (cl-random-time)))))
 
 (defun random-state-p (object)
   "Return t if OBJECT is a random-state object."
-  (and (vectorp object) (= (length object) 4)
+  (and (vectorp object) (eql (length object) 4)
        (eq (aref object 0) 'cl-random-state-tag)))
 
 ;;; Sequence functions.
@@ -452,50 +451,8 @@
            (compiled-function-instructions compiled)))
        (vector value) 1))))
 
-;;; Hash tables.
-
-;; The `regular' Common Lisp hash-table stuff has been moved into C.
-;; Only backward compatibility stuff remains here.
-(defun make-hashtable (size &optional test)
-  (make-hash-table :test test :size size))
-(defun make-weak-hashtable (size &optional test)
-  (make-hash-table :test test :size size :weakness t))
-(defun make-key-weak-hashtable (size &optional test)
-  (make-hash-table :test test :size size :weakness 'key))
-(defun make-value-weak-hashtable (size &optional test)
-  (make-hash-table :test test :size size :weakness 'value))
-
-(define-obsolete-function-alias 'hashtablep 'hash-table-p)
-(define-obsolete-function-alias 'hashtable-fullness 'hash-table-count)
-(define-obsolete-function-alias 'hashtable-test-function 'hash-table-test)
-(define-obsolete-function-alias 'hashtable-type 'hash-table-type)
-(define-obsolete-function-alias 'hashtable-size 'hash-table-size)
-(define-obsolete-function-alias 'copy-hashtable 'copy-hash-table)
-
-(make-obsolete 'make-hashtable            'make-hash-table)
-(make-obsolete 'make-weak-hashtable       'make-hash-table)
-(make-obsolete 'make-key-weak-hashtable   'make-hash-table)
-(make-obsolete 'make-value-weak-hashtable 'make-hash-table)
-(make-obsolete 'hash-table-type           'hash-table-weakness)
-
-(when (fboundp 'x-keysym-hash-table)
-  (make-obsolete 'x-keysym-hashtable 'x-keysym-hash-table))
-
-;; Compatibility stuff for old kludgy cl.el hash table implementation
-(defvar cl-builtin-gethash (symbol-function 'gethash))
-(defvar cl-builtin-remhash (symbol-function 'remhash))
-(defvar cl-builtin-clrhash (symbol-function 'clrhash))
-(defvar cl-builtin-maphash (symbol-function 'maphash))
-
-(defalias 'cl-gethash 'gethash)
-(defalias 'cl-puthash 'puthash)
-(defalias 'cl-remhash 'remhash)
-(defalias 'cl-clrhash 'clrhash)
-(defalias 'cl-maphash 'maphash)
-;; These three actually didn't exist in Emacs-20.
-(defalias 'cl-make-hash-table 'make-hash-table)
-(defalias 'cl-hash-table-p 'hash-table-p)
-(defalias 'cl-hash-table-count 'hash-table-count)
+;;; Hash tables. XEmacs; remove the compatibility stuff, which was all that
+;;; remained here, given the hash table implementation is in C.
 
 ;;; Some debugging aids.
 
@@ -643,7 +600,8 @@
   (let ((cl-macroexpand-cmacs full) (cl-compiling-file full)
 	(byte-compile-macro-environment nil))
     (setq form (cl-macroexpand-all form
-				   (and (not full) '((block) (eval-when)))))
+				   (and (not full)
+                                        '((block) (return-from) (eval-when)))))
     (message "Formatting...")
     (prog1 (cl-prettyprint form)
       (message ""))))
@@ -828,7 +786,8 @@
 	    (require 'descr-text)
 	    (when (zerop (buffer-size))
 	      ;; Don't use -literally in case of DOS line endings.
-	      (insert-file-contents describe-char-unicodedata-file))
+	      (insert-file-contents
+               (declare-boundp describe-char-unicodedata-file)))
 	    (goto-char (point-min))
 	    (setq case-fold-search nil)
 	    (and (re-search-forward (format #r"^\([0-9A-F]\{4,6\}\);%s;"
@@ -898,7 +857,9 @@
          (delete* key alist :test #'eq
                   :key (if key #'car-safe #'car-or-not-nil))))))
 
-(run-hooks 'cl-extra-load-hook)
+;; XEmacs; since cl-extra.el is dumped, cl-extra-load-hook is
+;; useless. (Dumped files normally shouldn't be using hooks, functionality
+;; should be implemented explicitly.)
 
 ;; XEmacs addition
 (provide 'cl-extra)