changeset 16845:adc714dc8e3c

(when, unless): Definitions moved from cl.el.
author Richard M. Stallman <rms@gnu.org>
date Wed, 08 Jan 1997 06:09:02 +0000
parents f919de623142
children 7fe3a413068d
files lisp/subr.el
diffstat 1 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Tue Jan 07 23:52:21 1997 +0000
+++ b/lisp/subr.el	Wed Jan 08 06:09:02 1997 +0000
@@ -43,17 +43,13 @@
   ;; 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))))
 
 ;;;; Keymap support.