unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15814: 24.3.50; Signal error on malformed bindings in `cl-symbol-macrolet' (patch)
@ 2013-11-05 20:40 Nathan Trapuzzano
  2013-11-06  0:46 ` Stefan Monnier
  2013-11-07  7:08 ` bug#15814: bootstrap fails due to recent cl-symbol-macrolet patch Paul Eggert
  0 siblings, 2 replies; 28+ messages in thread
From: Nathan Trapuzzano @ 2013-11-05 20:40 UTC (permalink / raw)
  To: 15814

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

`cl-symbol-macrolet' silently accepts both of the following forms:

(cl-symbol-macrolet ((foo bar baz) ...) ...)
(cl-symbol-macrolet ((foo) ...) ...)

In the former case, baz is ignored; in the latter case, foo is bound to
nil.

According to the CL docs, neither of these is valid.  (Not to mention,
they are both errors in Common Lisp.)  The attached patch asserts
properly formed bindings.

I checked the Emacs source to make sure there's no code in there relying
on this behavior.


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

From d6feb1195b8dc8f204d49761bfa828facbb4ba57 Mon Sep 17 00:00:00 2001
From: Nathan Trapuzzano <nbtrap@nbtrap.com>
Date: Tue, 5 Nov 2013 14:36:32 -0500
Subject: [PATCH] Signal error with malformed bindings in cl-symbol-macrolet.

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

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 828fcda..a4ae0ca 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): Signal error with
+	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..1e277f7 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1988,6 +1988,8 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...).
        (cl-symbol-macrolet ,(cdr bindings) ,@body)))
    ((null bindings) (macroexp-progn body))
    (t
+    (cl-assert (and (cdar bindings) (null (cl-cddar bindings))) nil
+	       "Malformed `cl-symbol-macrolet' binding: %S" (car bindings))
     (let ((previous-macroexpand (symbol-function 'macroexpand)))
       (unwind-protect
           (progn
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2013-11-11  4:55 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).