bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: npostavs
Subject: bug#18587: 24.4.50; error from cl-assert with a symbol argument
Date: Sun, 03 Jul 2016 23:53:15 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux)

severity 18587 minor
tags 18587 patch
quit

Tom Tromey <tom@tromey.com> 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 <npostavs@gmail.com>
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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]