Subject: Re: bug#30749: 26.0.91; (cl-)case is confused when a nil atom is used instead of a keylist

From: Noam Postavsky <[email-masked]>
Date: Thu, 08 Mar 2018 06:11:48 -0500

Alex Bennée <[email-masked]> 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?

--- i/lisp/emacs-lisp/cl-macs.el
+++ w/lisp/emacs-lisp/cl-macs.el
@@ -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 in
 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'.