-;; cl.el --- Common Lisp extensions for GNU Emacs Lisp
+;;; cl.el --- Common Lisp extensions for Emacs -*-byte-compile-dynamic: t;-*-
;; Copyright (C) 1993 Free Software Foundation, Inc.
;; 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, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; These macros are so simple and so often-used that it's better to have
;;; them all the time than to load them from cl-macs.el.
-(defmacro when (cond &rest body)
- "(when COND BODY...): if COND yields non-nil, do BODY, else return nil."
- (list 'if cond (cons 'progn body)))
-
-(defmacro unless (cond &rest body)
- "(unless COND BODY...): if COND yields nil, do BODY, else return nil."
- (cons 'if (cons cond (cons nil body))))
-
(defun cl-map-extents (&rest cl-args)
(if (fboundp 'next-overlay-at) (apply 'cl-map-overlays cl-args)
(if (fboundp 'map-extents) (apply 'map-extents cl-args))))
"Return the tenth element of the list LIST."
(nth 9 x))
-(defun caar (x)
- "Return the `car' of the `car' of X."
- (car (car x)))
-
-(defun cadr (x)
- "Return the `car' of the `cdr' of X."
- (car (cdr x)))
-
-(defun cdar (x)
- "Return the `cdr' of the `car' of X."
- (cdr (car x)))
-
-(defun cddr (x)
- "Return the `cdr' of the `cdr' of X."
- (cdr (cdr x)))
-
(defun caaar (x)
"Return the `car' of the `car' of the `car' of X."
(car (car (car x))))
"Return the `cdr' of the `cdr' of the `cdr' of the `cdr' of X."
(cdr (cdr (cdr (cdr x)))))
-(defun last (x &optional n)
- "Returns the last link in the list LIST.
-With optional argument N, returns Nth-to-last link (default 1)."
- (if n
- (let ((m 0) (p x))
- (while (consp p) (incf m) (pop p))
- (if (<= n 0) p
- (if (< n m) (nthcdr (- m n) x) x)))
- (while (consp (cdr x)) (pop x))
- x))
+;;(defun last* (x &optional n)
+;; "Returns the last link in the list LIST.
+;;With optional argument N, returns Nth-to-last link (default 1)."
+;; (if n
+;; (let ((m 0) (p x))
+;; (while (consp p) (incf m) (pop p))
+;; (if (<= n 0) p
+;; (if (< n m) (nthcdr (- m n) x) x)))
+;; (while (consp (cdr x)) (pop x))
+;; x))
(defun butlast (x &optional n)
"Returns a copy of LIST with the last N elements removed."
((function*) nil
(&or symbolp ([&optional 'macro] 'lambda (&rest sexp) &rest form)))
((eval-when) 1 (sexp &rest form))
- ((when unless) 1 (&rest form))
((declare) nil (&rest sexp))
((the) 1 (sexp &rest form))
((case ecase typecase etypecase) 1 (form &rest (sexp &rest form)))