From debff3c309833b9dd3939c474c2c446fa49f0f86 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 8 Jan 1997 06:09:02 +0000 Subject: [PATCH] (when, unless): Definitions moved from cl.el. --- lisp/subr.el | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 2205604641..b674f364e4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -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)))) ;;;; Keymap support. -- 2.20.1