summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-macs.el
diff options
context:
space:
mode:
authorNathan Trapuzzano <nbtrap@nbtrap.com>2013-11-06 23:38:00 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2013-11-06 23:38:00 -0500
commite6e4db3cac4630fc83e4bc520f99823572c3e592 (patch)
tree74767941ffad750434f2906d111ddd09a32ecee5 /lisp/emacs-lisp/cl-macs.el
parent099f5cd098de76422968c2755b4c37594e8fca2e (diff)
downloademacs-e6e4db3cac4630fc83e4bc520f99823572c3e592.tar.gz
emacs-e6e4db3cac4630fc83e4bc520f99823572c3e592.tar.bz2
emacs-e6e4db3cac4630fc83e4bc520f99823572c3e592.zip
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet): Print warning for
malformed bindings form. Fixes: debbugs:15814
Diffstat (limited to 'lisp/emacs-lisp/cl-macs.el')
-rw-r--r--lisp/emacs-lisp/cl-macs.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 60fdc09c053..bd97bcb585c 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.
@@ -2726,7 +2734,7 @@ macro that returns its `&whole' argument."
(let* ((cl-entry (cons (nth 1 (nth 1 cl-form)) nil))
(cl--active-block-names (cons cl-entry cl--active-block-names))
(cl-body (macroexpand-all ;Performs compiler-macro expansions.
- (cons 'progn (cddr cl-form))
+ (macroexp-progn (cddr cl-form))
macroexpand-all-environment)))
;; FIXME: To avoid re-applying macroexpand-all, we'd like to be able
;; to indicate that this return value is already fully expanded.