GNU bug report logs - #30749
26.0.91; (cl-)case is confused when a nil atom is used instead of a keylist

Previous Next

Package: emacs;

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


View this message in rfc822 format

From: Alex Bennée <alex.bennee <at> linaro.org>
To: 30749 <at> 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 10:28:11 +0000
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. The
following behaviour shows up on emacs -Q:

(require 'cl)

(case nil
  ((nil) "nil")
  ((t) "default"))
"nil"

(case nil
  (nil "nil")
  (t "default"))
"default"

(case nil
  ('nil "nil")
  ('t "default"))
"nil"

(case t
  ('nil "nil")
  ('t "default"))
"default"

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.

In GNU Emacs 26.0.91 (build 16, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2018-03-06 built on zen
Repository revision: 0efe0bd233de20bfb5bd9d06b255fc8ecf04602b
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Ubuntu 16.04.3 LTS

--
Alex Bennée




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.