[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#30749: 26.0.91; (cl-)case is confused when a nil atom is used instea
bug#30749: 26.0.91; (cl-)case is confused when a nil atom is used instead of a keylist
Thu, 08 Mar 2018 06:11:48 -0500
Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)
Alex Bennée <address@hidden> writes:
> I got confused why my case statement was failing as I'd used the second
> form assuming that having nil as an atom would work. I'm not sure why
> the quoting fixed it but it's certainly a confusing inconsistency.
'nil is the same as (quote nil)
> I think this is probably fixable with just making the docstring clearer
> as the results of handling the duel atom/list of nil might have
> unexpected results.
So just add a "non-nil" perhaps?
@@ -763,7 +763,7 @@ cl-case
"Eval EXPR and choose among clauses on that value.
Each clause looks like (KEYLIST BODY...). EXPR is evaluated and compared
against each key in each KEYLIST; the corresponding BODY is evaluated.
-If no clause succeeds, cl-case returns nil. A single atom may be used in
+If no clause succeeds, cl-case returns nil. A single non-nil atom may be used
place of a KEYLIST of one atom. A KEYLIST of t or `otherwise' is
allowed only in the final clause, and matches if no other keys match.
Key values are compared by `eql'.