GNU bug report logs -
#30749
26.0.91; (cl-)case is confused when a nil atom is used instead of a keylist
Previous Next
Reported by: Alex Bennée <alex.bennee <at> linaro.org>
Date: Thu, 8 Mar 2018 10:29:02 UTC
Severity: minor
Tags: fixed
Found in version 26.0.91
Fixed in version 26.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 30749 <at> debbugs.gnu.org (full text, mbox):
Alex Bennée <alex.bennee <at> linaro.org> 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'.
This bug report was last modified 7 years and 71 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.