unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Nathan Trapuzzano <nbtrap@nbtrap.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 15814@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	[thread overview]
Message-ID: <87mwlggakp.fsf@nbtrap.com> (raw)
In-Reply-To: <jwvbo1x9ddi.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Wed, 06 Nov 2013 21:08:39 -0500")

[-- Attachment #1: Type: text/plain, Size: 315 bytes --]

Stefan Monnier <monnier@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cl-macs.el.patch --]
[-- Type: text/x-diff, Size: 2248 bytes --]

From 3843a58d0ebcaea9e6c9446ca6b6f52611c8097d Mon Sep 17 00:00:00 2001
From: Nathan Trapuzzano <nbtrap@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@nbtrap.com>
+
+	* emacs-lisp/cl-macs.el (cl-symbol-macrolet): Print warning for
+	malformed bindings form.
+
 2013-11-05  Eli Zaretskii  <eliz@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


  reply	other threads:[~2013-11-07  3:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 20:40 bug#15814: 24.3.50; Signal error on malformed bindings in `cl-symbol-macrolet' (patch) Nathan Trapuzzano
2013-11-06  0:46 ` Stefan Monnier
2013-11-06  2:19   ` Nathan Trapuzzano
2013-11-06  3:20     ` Stefan Monnier
2013-11-06 11:16       ` Nathan Trapuzzano
2013-11-06 13:45         ` Stefan Monnier
2013-11-07  1:14           ` Nathan Trapuzzano
2013-11-07  2:08             ` Stefan Monnier
2013-11-07  3:22               ` Nathan Trapuzzano [this message]
2013-11-07  4:38                 ` Stefan Monnier
2013-11-07 19:51                   ` Nathan Trapuzzano
2013-11-08  1:21                     ` Stefan Monnier
2013-11-08  1:29                       ` Nathan Trapuzzano
2013-11-08  3:02                         ` Stefan Monnier
2013-11-08 11:40                           ` Nathan Trapuzzano
2013-11-08 13:33                             ` Stefan Monnier
2013-11-08 14:39                               ` Nathan Trapuzzano
2013-11-08 19:06                                 ` Stefan Monnier
2013-11-09  2:06                                   ` Nathan Trapuzzano
2013-11-09  8:36                                     ` Andreas Schwab
2013-11-09 12:00                                       ` Nathan Trapuzzano
2013-11-11  4:55                                         ` Stefan Monnier
2013-11-07  7:08 ` bug#15814: bootstrap fails due to recent cl-symbol-macrolet patch Paul Eggert
2013-11-07 12:58   ` Nathan Trapuzzano
2013-11-07 19:46     ` Stefan Monnier
2013-11-07 21:03       ` Glenn Morris
2013-11-07 22:07         ` Glenn Morris
2013-11-08  1:34           ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwlggakp.fsf@nbtrap.com \
    --to=nbtrap@nbtrap.com \
    --cc=15814@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).