]> git.eshelyaron.com Git - emacs.git/commitdiff
(when, unless): Definitions moved from cl.el.
authorRichard M. Stallman <rms@gnu.org>
Wed, 8 Jan 1997 06:09:02 +0000 (06:09 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 8 Jan 1997 06:09:02 +0000 (06:09 +0000)
lisp/subr.el

index 220560464165c182221dc9a1eb4164df8046a326..b674f364e46790f5ea4775543a613fb68cf6dcd2 100644 (file)
@@ -43,17 +43,13 @@ BODY should be a list of lisp expressions."
   ;; depend on backquote.el.
   (list 'function (cons 'lambda cdr)))
 
-;;(defmacro defun-inline (name args &rest body)
-;;  "Create an \"inline defun\" (actually a macro).
-;;Use just like `defun'."
-;;  (nconc (list 'defmacro name '(&rest args))
-;;      (if (stringp (car body))
-;;          (prog1 (list (car body))
-;;            (setq body (or (cdr body) body))))
-;;      (list (list 'cons (list 'quote
-;;                              (cons 'lambda (cons args body)))
-;;                  'args))))
+(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))))
 \f
 ;;;; Keymap support.