From: Noam Postavsky <npostavs@gmail.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: 30749@debbugs.gnu.org
Subject: bug#30749: 26.0.91; (cl-)case is confused when a nil atom is used instead of a keylist
Date: Thu, 08 Mar 2018 06:11:48 -0500 [thread overview]
Message-ID: <87o9jy2557.fsf@gmail.com> (raw)
In-Reply-To: <87fu5azwsk.fsf@linaro.org> ("Alex \=\?utf-8\?Q\?Benn\=C3\=A9e\=22's\?\= message of "Thu, 08 Mar 2018 10:28:11 +0000")
Alex Bennée <alex.bennee@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'.
next prev parent reply other threads:[~2018-03-08 11:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-08 10:28 bug#30749: 26.0.91; (cl-)case is confused when a nil atom is used instead of a keylist Alex Bennée
2018-03-08 11:11 ` Noam Postavsky [this message]
2018-03-08 11:34 ` Alex Bennée
2018-03-10 22:57 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o9jy2557.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=30749@debbugs.gnu.org \
--cc=alex.bennee@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).