emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Declarations in macro definitions


From: Gerd Moellmann
Subject: Re: Declarations in macro definitions
Date: 20 Mar 2002 13:11:29 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

> > In that case I guess my patch won't be needed.
> 
> I don't think that there is anything already installed that does what
> you patch does.  Maybe someone has been working on this, but at least
> I haven't heard anything conclusive.

In case the patch might be useful anyway---I see that I forgot to send
the diff for bytecomp.el (the thing would be pretty useless if it
didn't work with compiled code :-).  Here it is:

*** bytecomp.el 2002/03/13 23:05:30     2.94
--- bytecomp.el 2002/03/20 12:06:35
***************
*** 1980,1985 ****
--- 1980,2001 ----
               (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 ((tail (nthcdr 2 form)))
+       (when (stringp (car (cdr tail)))
+         (setq tail (cdr tail)))
+       (while (and (consp (car (cdr tail)))
+                   (eq (car (car (cdr tail))) 'declare))
+         (let ((declaration (car (cdr tail))))
+           (setcdr tail (cdr (cdr tail)))
+           (princ `(if macro-declaration-function
+                       (funcall macro-declaration-function
+                                ',name ',declaration))
+                  outbuffer)))))
+       
      (let* ((new-one (byte-compile-lambda (cons 'lambda (nthcdr 2 form))))
           (code (byte-compile-byte-code-maker new-one)))
        (if this-one



reply via email to

[Prev in Thread] Current Thread [Next in Thread]