GNU bug report logs - #15814
24.3.50; Signal error on malformed bindings in `cl-symbol-macrolet' (patch)

Previous Next

Package: emacs;

Reported by: Nathan Trapuzzano <nbtrap <at> nbtrap.com>

Date: Tue, 5 Nov 2013 20:42:01 UTC

Severity: minor

Tags: patch

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Nathan Trapuzzano <nbtrap <at> nbtrap.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 15814 <at> debbugs.gnu.org
Subject: bug#15814: 24.3.50; Signal error on malformed bindings in `cl-symbol-macrolet' (patch)
Date: Wed, 06 Nov 2013 22:22:30 -0500
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> What's the alternative?  Transform malformed let in some undefined way?
>
> Yup.  Just like we've done so far.

I think I understand what you want.  This patch uses
macroexp--warn-and-return.  I'll try to move the checks in
bytecomp.el/cconv.el later.

Nathan

[cl-macs.el.patch (text/x-diff, inline)]
From 3843a58d0ebcaea9e6c9446ca6b6f52611c8097d Mon Sep 17 00:00:00 2001
From: Nathan Trapuzzano <nbtrap <at> nbtrap.com>
Date: Tue, 5 Nov 2013 14:36:32 -0500
Subject: [PATCH] Print warning for malformed bindings in cl-symbol-macrolet.

---
 lisp/ChangeLog             |  5 +++++
 lisp/emacs-lisp/cl-macs.el | 18 +++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 828fcda..824e73c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-05  Nathan Trapuzzano  <nbtrap <at> nbtrap.com>
+
+	* emacs-lisp/cl-macs.el (cl-symbol-macrolet): Print warning for
+	malformed bindings form.
+
 2013-11-05  Eli Zaretskii  <eliz <at> gnu.org>
 
 	* international/quail.el (quail-help): Be more explicit about the
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 60fdc09..9cdde5e 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1992,11 +1992,19 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...).
       (unwind-protect
           (progn
             (fset 'macroexpand #'cl--sm-macroexpand)
-            ;; FIXME: For N bindings, this will traverse `body' N times!
-            (macroexpand-all (cons 'progn body)
-                             (cons (list (symbol-name (caar bindings))
-                                         (cl-cadar bindings))
-                                   macroexpand-all-environment)))
+            (let ((expansion
+                   ;; FIXME: For N bindings, this will traverse `body'
+                   ;; N times!
+                   (macroexpand-all (cons 'progn body)
+                                    (cons (list (symbol-name (caar bindings))
+                                                (cl-cadar bindings))
+                                          macroexpand-all-environment))))
+              (if (or (null (cdar bindings)) (cl-cddar bindings))
+                  (macroexp--warn-and-return
+                   (format "Malformed `cl-symbol-macrolet' binding: %S"
+                           (car bindings))
+                   expansion)
+                expansion)))
         (fset 'macroexpand previous-macroexpand))))))
 
 ;;; Multiple values.
-- 
1.8.4.2


This bug report was last modified 11 years and 274 days ago.

Previous Next


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