Stefan Monnier <[EMAIL PROTECTED]> writes:

>> `when' should be `and' in this code, for clarity. I don't think this
>> has an effect on functioning, but `when' should generally not be used
>> when its value is important, as in this case. Here, the return value
>> is an argument to function `buffer-list'.
>
> I disagree, so let's leave it.

If we're going to use the return value of 'when' in this manner, we
should document 'when' to state what its return value is (and the same
goes for 'unless' as well).  These changes are based on the
documentation for 'if':

Index: lisp/subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.546
diff -u -r1.546 subr.el
--- lisp/subr.el        9 Feb 2007 23:09:16 -0000       1.546
+++ lisp/subr.el        17 Feb 2007 23:28:34 -0000
@@ -99,12 +99,24 @@
              (list 'setq listname (list 'cdr listname)))))
 
 (defmacro when (cond &rest body)
-  "If COND yields non-nil, do BODY, else return nil."
+  "If COND yields non-nil, do BODY.
+Returns nil or the value of the last of the BODY's.
+If COND yields nil, the value is nil.
+If COND yields non-nil, and there are no BODY's, the value is nil.
+BODY... is zero or more expressions.
+
+\(fn COND BODY...)"
   (declare (indent 1) (debug t))
   (list 'if cond (cons 'progn body)))
 
 (defmacro unless (cond &rest body)
-  "If COND yields nil, do BODY, else return nil."
+  "If COND yields nil, do BODY.
+Returns nil or the value of the last of the BODY's.
+If COND yields non-nil, the value is nil.
+If COND yields nil, and there are no BODY's, the value is nil.
+BODY... is zero or more expressions.
+
+\(fn COND BODY...)"
   (declare (indent 1) (debug t))
   (cons 'if (cons cond (cons nil body))))
 


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to