]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/byte-run.el
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / lisp / emacs-lisp / byte-run.el
index e3179a660709e5320da7541b09db6f28ef61c29c..3168ddb16e5095868fa1a78998c7687dbd3ce5bc 100644 (file)
@@ -81,10 +81,14 @@ The return value of this function is not used."
          #'(lambda (f _args new-name when)
              `(make-obsolete ',f ',new-name ,when)))
    (list 'compiler-macro
-         #'(lambda (f _args compiler-function)
-             (if (not (symbolp compiler-function))
-                 (error "Only symbols are supported in `compiler-macro'")
-               `(put ',f 'compiler-macro #',compiler-function))))
+         #'(lambda (f args compiler-function)
+             ;; FIXME: Make it possible to just reuse `args'.
+             `(eval-and-compile
+                (put ',f 'compiler-macro
+                     ,(if (eq (car-safe compiler-function) 'lambda)
+                          `(lambda ,(append (cadr compiler-function) args)
+                             ,@(cddr compiler-function))
+                        `#',compiler-function)))))
    (list 'doc-string
          #'(lambda (f _args pos)
              (list 'put (list 'quote f) ''doc-string-elt (list 'quote pos))))