comparison lisp/cl-macs.el @ 5511:7b5254f6e0d5

Fix CL compliance of [symbol-]macrolet. -------------------- ChangeLog entries follow: -------------------- lisp/ChangeLog addition: 2011-05-25 Didier Verna <didier@xemacs.org> * cl-macs.el (macrolet): * cl-macs.el (symbol-macrolet): Don't require one mandatory [symbol-]macro definition in the first argument. The Common Lisp standard allows the list of definitions to be empty.
author Didier Verna <didier@xemacs.org>
date Wed, 25 May 2011 14:01:38 +0200
parents 9ac0016d8fe8
children 9d519ab9fd68
comparison
equal deleted inserted replaced
5510:6b3caa55668c 5511:7b5254f6e0d5
1767 cl-macro-environment))) 1767 cl-macro-environment)))
1768 1768
1769 ;; The following ought to have a better definition for use with newer 1769 ;; The following ought to have a better definition for use with newer
1770 ;; byte compilers. 1770 ;; byte compilers.
1771 ;;;###autoload 1771 ;;;###autoload
1772 (defmacro* macrolet (((name arglist &optional docstring &body body) 1772 (defmacro* macrolet ((&rest macros) &body form)
1773 &rest macros) &body form)
1774 "Make temporary macro definitions. 1773 "Make temporary macro definitions.
1775 This is like `flet', but for macros instead of functions." 1774 This is like `flet', but for macros instead of functions."
1776 (cl-macroexpand-all (cons 'progn form) 1775 (cl-macroexpand-all (cons 'progn form)
1777 (nconc 1776 (nconc
1778 (loop 1777 (loop
1779 for (name . details) 1778 for (name . details)
1780 in (cons (list* name arglist docstring body) macros) 1779 in macros
1781 collect 1780 collect
1782 (list* name 'lambda (cdr (cl-transform-lambda details 1781 (list* name 'lambda (cdr (cl-transform-lambda details
1783 name)))) 1782 name))))
1784 cl-macro-environment))) 1783 cl-macro-environment)))
1785 1784
1786 ;;;###autoload 1785 ;;;###autoload
1787 (defmacro* symbol-macrolet (((name expansion) &rest symbol-macros) &body form) 1786 (defmacro* symbol-macrolet ((&rest symbol-macros) &body form)
1788 "Make symbol macro definitions. 1787 "Make temporary symbol macro definitions.
1789 Within the body FORMs, references to the variable NAME will be replaced 1788 Elements in SYMBOL-MACROS look like (NAME EXPANSION).
1790 by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...)." 1789 Within the body FORMs, a reference to NAME is replaced with its EXPANSION,
1791 (check-type name symbol) 1790 and (setq NAME ...) acts like (setf EXPANSION ...)."
1792 (cl-macroexpand-all (cons 'progn form) 1791 (cl-macroexpand-all (cons 'progn form)
1793 (nconc (list (list (eq-hash name) expansion)) 1792 (nconc (loop
1794 (loop
1795 for (name expansion) in symbol-macros 1793 for (name expansion) in symbol-macros
1796 do (check-type name symbol) 1794 do (check-type name symbol)
1797 collect (list (eq-hash name) expansion)) 1795 collect (list (eq-hash name) expansion))
1798 cl-macro-environment))) 1796 cl-macro-environment)))
1799 1797