Clarify that nil doesn't match itself as a cl-case clause (Bug#30749)

* lisp/emacs-lisp/cl-macs.el (cl-case): Mention that the ATOM
=> (ATOM) short form is only for non-nil ATOMs.
This commit is contained in:
Noam Postavsky 2018-03-08 18:48:39 -05:00
parent df0e7e2b9e
commit e244fed5e0

View file

@ -761,13 +761,15 @@ The result of the body appears to the compiler as a quoted constant."
;;;###autoload ;;;###autoload
(defmacro cl-case (expr &rest clauses) (defmacro cl-case (expr &rest clauses)
"Eval EXPR and choose among clauses on that value. "Eval EXPR and choose among clauses on that value.
Each clause looks like (KEYLIST BODY...). EXPR is evaluated and compared Each clause looks like (KEYLIST BODY...). EXPR is evaluated and
against each key in each KEYLIST; the corresponding BODY is evaluated. compared against each key in each KEYLIST; the corresponding BODY
If no clause succeeds, cl-case returns nil. A single atom may be used in is evaluated. If no clause succeeds, cl-case returns nil. A
place of a KEYLIST of one atom. A KEYLIST of t or `otherwise' is single non-nil atom may be used in place of a KEYLIST of one
allowed only in the final clause, and matches if no other keys match. atom. A KEYLIST of t or `otherwise' is allowed only in the final
Key values are compared by `eql'. clause, and matches if no other keys match. Key values are
\n(fn EXPR (KEYLIST BODY...)...)" compared by `eql'.
\(fn EXPR (KEYLIST BODY...)...)"
(declare (indent 1) (debug (form &rest (sexp body)))) (declare (indent 1) (debug (form &rest (sexp body))))
(macroexp-let2 macroexp-copyable-p temp expr (macroexp-let2 macroexp-copyable-p temp expr
(let* ((head-list nil)) (let* ((head-list nil))