Subject: bug#18587: 24.4.50; error from cl-assert with a symbol argument

From: [email-masked]
Date: Sun, 03 Jul 2016 23:53:15 -0400

severity 18587 minor
tags 18587 patch
quit

Tom Tromey <[email-masked]> writes:

> This works fine:
>
> (let ((x 5))
>   (cl-assert x))
>
> However, to my surprise, this fails with an error from macroexpand:
>
> (let ((x 5))
>   (cl-assert x t))
>
> Writing (cl-assert (progn x) t) works ok, but I think ideally I
> shouldn't have to do that.

Yeah, seems kind of silly.  Here's a patch:

>From b0fbb6f88c09e13977dca1d24ef76e40312fe4b5 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[email-masked]>
Date: Sun, 3 Jul 2016 23:44:14 -0400
Subject: [PATCH v1] Fix cl-assert with atomp FORM, non-nil SHOW-ARGS

* lisp/emacs-lisp/cl-macs.el (cl-assert): Don't require that FORM is a
list when showing its (non-existent) arguments.
---
 lisp/emacs-lisp/cl-macs.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index d2c90c2..b12c8bf 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2978,7 +2978,7 @@ cl-assert
                          (delq nil (mapcar (lambda (x)
                                              (unless (macroexp-const-p x)
                                                x))
-                                           (cdr form))))))
+                                           (cdr-safe form))))))
 	 `(progn
             (or ,form
                 (cl--assertion-failed
-- 
2.8.0