From: Glenn Morris Date: Wed, 9 Oct 2013 17:17:20 +0000 (-0400) Subject: Doc tweaks for cond X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1318 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fa02290953acd2d0cda982d98ffd32e9f6873d28;p=emacs.git Doc tweaks for cond * doc/lispref/control.texi (Conditionals): Copyedits. * src/eval.c (Fcond): Doc tweak. --- diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 4f6a92ef5f3..8b55cfddec2 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,7 @@ +2013-10-09 Glenn Morris + + * control.texi (Conditionals): Copyedits. (Bug#15558) + 2013-10-08 Eli Zaretskii Support menus on text-mode terminals. diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index 70eabcd84a4..34a02aab69d 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -218,15 +218,11 @@ list is the @var{condition}; the remaining elements, if any, the @code{cond} tries the clauses in textual order, by evaluating the @var{condition} of each clause. If the value of @var{condition} is non-@code{nil}, the clause ``succeeds''; then @code{cond} evaluates its -@var{body-forms}, and the value of the last of @var{body-forms} becomes -the value of the @code{cond}. The remaining clauses are ignored. +@var{body-forms}, and returns the value of the last of @var{body-forms}. +Any remaining clauses are ignored. If the value of @var{condition} is @code{nil}, the clause ``fails'', so -the @code{cond} moves on to the following clause, trying its -@var{condition}. - -If every @var{condition} evaluates to @code{nil}, so that every clause -fails, @code{cond} returns @code{nil}. +the @code{cond} moves on to the following clause, trying its @var{condition}. A clause may also look like this: @@ -235,8 +231,11 @@ A clause may also look like this: @end example @noindent -Then, if @var{condition} is non-@code{nil} when tested, the value of -@var{condition} becomes the value of the @code{cond} form. +Then, if @var{condition} is non-@code{nil} when tested, the @code{cond} +form returns the value of @var{condition}. + +If every @var{condition} evaluates to @code{nil}, so that every clause +fails, @code{cond} returns @code{nil}. The following example has four clauses, which test for the cases where the value of @code{x} is a number, string, buffer and symbol, diff --git a/src/ChangeLog b/src/ChangeLog index eee3ee8237e..3ae42ea87c8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2013-10-09 Glenn Morris + + * eval.c (Fcond): Doc tweak. + 2013-10-09 Eli Zaretskii * xfaces.c (x_free_gc) [HAVE_X_WINDOWS, HAVE_NTGUI]: Don't pass diff --git a/src/eval.c b/src/eval.c index 3b4dc9a88d1..1e0a63a0ece 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1,6 +1,6 @@ /* Evaluator for GNU Emacs Lisp interpreter. - Copyright (C) 1985-1987, 1993-1995, 1999-2013 Free Software - Foundation, Inc. + +Copyright (C) 1985-1987, 1993-1995, 1999-2013 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -405,9 +405,9 @@ Each clause looks like (CONDITION BODY...). CONDITION is evaluated and, if the value is non-nil, this clause succeeds: then the expressions in BODY are evaluated and the last one's value is the value of the cond-form. +If a clause has one element, as in (CONDITION), then the cond-form +returns CONDITION's value, if that is non-nil. If no clause succeeds, cond returns nil. -If a clause has one element, as in (CONDITION), -CONDITION's value if non-nil is returned from the cond-form. usage: (cond CLAUSES...) */) (Lisp_Object args) {