diff lisp/bytecomp.el @ 5506:b0d87f92e60b

Complete support for macro-declaration-function, bytecomp{,-runtime}.el lisp/ChangeLog addition: 2011-05-07 Aidan Kehoe <kehoea@parhasard.net> * bytecomp-runtime.el: * bytecomp.el (byte-compile-file-form-defmumble): * bytecomp-runtime.el (macro-declaration-function): New. * subr.el: * subr.el (macro-declaration-function): Removed. Add support for macro-declaration-function, which is a GNU mechanism for indicating indentation and edebug information in macros (and only in macros). src/ChangeLog addition: 2011-05-07 Aidan Kehoe <kehoea@parhasard.net> * eval.c: * eval.c (Fdefmacro): * eval.c (syms_of_eval): Support macro-declaration-function in defmacro, incompletely and without documentation. * lisp.h: Declare Fnth here, necessary for the previous changes.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 08 May 2011 09:19:25 +0100
parents 7b5946dbfb96
children b90c153730c7
line wrap: on
line diff
--- a/lisp/bytecomp.el	Sat May 07 21:27:27 2011 +0100
+++ b/lisp/bytecomp.el	Sun May 08 09:19:25 2011 +0100
@@ -2297,6 +2297,26 @@
 	       (stringp (car-safe (cdr-safe (cdr-safe body)))))
 	  (byte-compile-warn "Probable `\"' without `\\' in doc string of %s"
 			     (nth 1 form))))
+
+    ;; Generate code for declarations in macro definitions.
+    ;; Remove declarations from the body of the macro definition.
+    (when macrop
+      (let ((byte-compile-defmacro-body (nthcdr 3 form)))
+        (if (stringp (car byte-compile-defmacro-body))
+            (setq byte-compile-defmacro-body (nthcdr 4 form)))
+        (when (and (consp byte-compile-defmacro-body)
+                   (eq 'declare (car-safe (car byte-compile-defmacro-body))))
+          (if (eq 'declare (car-safe (car-safe
+                                      (cdr byte-compile-defmacro-body))))
+              (byte-compile-warn "Multiple macro-specific `declare' calls \
+not supported by XEmacs."))
+          (setq byte-compile-output-preface
+                (byte-compile-top-level
+                 `(progn (and macro-declaration-function
+                              (funcall macro-declaration-function
+                                       ',name
+                                       ',(car byte-compile-defmacro-body)))
+                         ,byte-compile-output-preface) t 'file)))))
     (let* ((new-one (byte-compile-lambda (cons 'lambda (nthcdr 2 form))))
 	   (code (byte-compile-byte-code-maker new-one))
            (docform-info