GNU bug report logs - #18587
24.4.50; error from cl-assert with a symbol argument

Previous Next

Package: emacs;

Reported by: Tom Tromey <tom <at> tromey.com>

Date: Tue, 30 Sep 2014 05:57:01 UTC

Severity: minor

Tags: patch

Found in version 24.4.50

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: Tom Tromey <tom <at> tromey.com>
Cc: 18587 <at> debbugs.gnu.org
Subject: bug#18587: 24.4.50; error from cl-assert with a symbol argument
Date: Sun, 03 Jul 2016 23:53:15 -0400
[Message part 1 (text/plain, inline)]
severity 18587 minor
tags 18587 patch
quit

Tom Tromey <tom <at> 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:

[v1-0001-Fix-cl-assert-with-atomp-FORM-non-nil-SHOW-ARGS.patch (text/x-diff, inline)]
From b0fbb6f88c09e13977dca1d24ef76e40312fe4b5 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> 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


This bug report was last modified 8 years and 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.