]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/cl.el
*** empty log message ***
[gnu-emacs] / lisp / emacs-lisp / cl.el
index 830a3e8d1ffc2eaa11dcd3a6c974a2d88e17f941..7be8a0561a23e861ae5a3cd1083c32be954ba2c0 100644 (file)
@@ -123,7 +123,7 @@ Floating-point numbers of equal value are `eql', but they may not be `eq'."
 ;;; can safely be used in .emacs files.
 
 (defmacro incf (place &optional x)
-  "(incf PLACE [X]): increment PLACE by X (1 by default).
+  "Increment PLACE by X (1 by default).
 PLACE may be a symbol, or any generalized variable allowed by `setf'.
 The return value is the incremented value of PLACE."
   (if (symbolp place)
@@ -131,7 +131,7 @@ The return value is the incremented value of PLACE."
     (list 'callf '+ place (or x 1))))
 
 (defmacro decf (place &optional x)
-  "(decf PLACE [X]): decrement PLACE by X (1 by default).
+  "Decrement PLACE by X (1 by default).
 PLACE may be a symbol, or any generalized variable allowed by `setf'.
 The return value is the decremented value of PLACE."
   (if (symbolp place)
@@ -139,7 +139,7 @@ The return value is the decremented value of PLACE."
     (list 'callf '- place (or x 1))))
 
 (defmacro pop (place)
-  "(pop PLACE): remove and return the head of the list stored in PLACE.
+  "Remove and return the head of the list stored in PLACE.
 Analogous to (prog1 (car PLACE) (setf PLACE (cdr PLACE))), though more
 careful about evaluating each argument only once and in the right order.
 PLACE may be a symbol, or any generalized variable allowed by `setf'."
@@ -148,7 +148,7 @@ PLACE may be a symbol, or any generalized variable allowed by `setf'."
     (cl-do-pop place)))
 
 (defmacro push (x place)
-  "(push X PLACE): insert X at the head of the list stored in PLACE.
+  "Insert X at the head of the list stored in PLACE.
 Analogous to (setf PLACE (cons X PLACE)), though more careful about
 evaluating each argument only once and in the right order.  PLACE may
 be a symbol, or any generalized variable allowed by `setf'."
@@ -222,7 +222,7 @@ If FORM is not a macro call, it is returned unchanged.
 Otherwise, the macro is expanded and the expansion is considered
 in place of FORM.  When a non-macro-call results, it is returned.
 
-The second optional arg ENVIRONMENT species an environment of macro
+The second optional arg ENVIRONMENT specifies an environment of macro
 definitions to shadow the loaded ones for use in file byte-compilation."
   (let ((cl-macro-environment cl-env))
     (while (progn (setq cl-macro (funcall cl-old-macroexpand cl-macro cl-env))
@@ -329,44 +329,41 @@ SEQ, this is like `mapcar'.  With several, it is like the Common Lisp
 ;;; List functions.
 
 (defalias 'first 'car)
+(defalias 'second 'cadr)
 (defalias 'rest 'cdr)
 (defalias 'endp 'null)
 
-(defun second (x)
-  "Return the second element of the list LIST."
-  (car (cdr x)))
-
 (defun third (x)
   "Return the third element of the list LIST."
-  (car (cdr (cdr x))))
+  `(car (cdr (cdr ,x))))
 
 (defun fourth (x)
   "Return the fourth element of the list LIST."
-  (nth 3 x))
+  `(nth 3 ,x))
 
 (defun fifth (x)
   "Return the fifth element of the list LIST."
-  (nth 4 x))
+  `(nth 4 ,x))
 
 (defun sixth (x)
   "Return the sixth element of the list LIST."
-  (nth 5 x))
+  `(nth 5 ,x))
 
 (defun seventh (x)
   "Return the seventh element of the list LIST."
-  (nth 6 x))
+  `(nth 6 ,x))
 
 (defun eighth (x)
   "Return the eighth element of the list LIST."
-  (nth 7 x))
+  `(nth 7 ,x))
 
 (defun ninth (x)
   "Return the ninth element of the list LIST."
-  (nth 8 x))
+  `(nth 8 ,x))
 
 (defun tenth (x)
   "Return the tenth element of the list LIST."
-  (nth 9 x))
+  `(nth 9 ,x))
 
 (defun caaar (x)
   "Return the `car' of the `car' of the `car' of X."
@@ -565,18 +562,22 @@ Keywords supported:  :test :test-not :key"
 (put 'cl-assertion-failed 'error-conditions '(error))
 (put 'cl-assertion-failed 'error-message "Assertion failed")
 
+(defvar cl-fake-autoloads nil
+  "Non-nil means don't make CL functions autoload.")
+
 ;;; Autoload the other portions of the package.
 (mapcar (function
         (lambda (set)
-          (mapcar (function
-                   (lambda (func)
-                     (autoload func (car set) nil nil (nth 1 set))))
-                  (cddr set))))
+          (let ((file (if cl-fake-autoloads "<none>" (car set))))
+            (mapcar (function
+                     (lambda (func)
+                       (autoload func (car set) nil nil (nth 1 set))))
+                    (cddr set)))))
        '(("cl-extra" nil
           coerce equalp cl-map-keymap maplist mapc mapl mapcan mapcon
           cl-map-keymap cl-map-keymap-recursively cl-map-intervals
           cl-map-overlays cl-set-frame-visible-p cl-float-limits
-          gcd lcm isqrt expt floor* ceiling* truncate* round*
+          gcd lcm isqrt floor* ceiling* truncate* round*
           mod* rem* signum random* make-random-state random-state-p
           subseq concatenate cl-mapcar-many map some every notany
           notevery revappend nreconc list-length tailp copy-tree get* getf
@@ -585,14 +586,14 @@ Keywords supported:  :test :test-not :key"
           cl-hash-table-count cl-progv-before cl-prettyexpand
           cl-macroexpand-all)
          ("cl-seq" nil
-          reduce fill replace remq remove remove* remove-if remove-if-not
-          delete delete* delete-if delete-if-not remove-duplicates
+          reduce fill replace remove* remove-if remove-if-not
+          delete* delete-if delete-if-not remove-duplicates
           delete-duplicates substitute substitute-if substitute-if-not
           nsubstitute nsubstitute-if nsubstitute-if-not find find-if
           find-if-not position position-if position-if-not count count-if
           count-if-not mismatch search sort* stable-sort merge member*
           member-if member-if-not cl-adjoin assoc* assoc-if assoc-if-not
-          rassoc* rassoc rassoc-if rassoc-if-not union nunion intersection
+          rassoc* rassoc-if rassoc-if-not union nunion intersection
           nintersection set-difference nset-difference set-exclusive-or
           nset-exclusive-or subsetp subst-if subst-if-not nsubst nsubst-if
           nsubst-if-not sublis nsublis tree-equal)