]> git.eshelyaron.com Git - emacs.git/commitdiff
(byte-compile-file-form-defmumble):
authorGerd Moellmann <gerd@gnu.org>
Sun, 24 Mar 2002 19:48:27 +0000 (19:48 +0000)
committerGerd Moellmann <gerd@gnu.org>
Sun, 24 Mar 2002 19:48:27 +0000 (19:48 +0000)
Handle declarations in macro definitions.

lisp/ChangeLog
lisp/emacs-lisp/bytecomp.el

index 252445a2bd2787fc363e2ba0325205e57e16bef0..9e1a9cb01586764ba808c06335d78ca0613512ee 100644 (file)
@@ -1,3 +1,11 @@
+2002-03-24  Gerd Moellmann  <gerd@gnu.org>
+
+       * subr.el (macro-declaration-function): New function.  Set the
+       variable macro-declaration-function to it.
+
+       * emacs-lisp/bytecomp.el (byte-compile-file-form-defmumble): 
+       Handle declarations in macro definitions.
+
 2002-03-24  Eli Zaretskii  <eliz@is.elta.co.il>
 
        * facemenu.el (facemenu-get-face): Remove unised variable
index 7fabdd603a862ab4c590b63be883562431c08ee3..f569a29281628fe3c77d70c1efbaf378cfe8475f 100644 (file)
@@ -1,6 +1,6 @@
 ;;; bytecomp.el --- compilation of Lisp code into byte code
 
-;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1998, 2000, 2001
+;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1998, 2000, 2001, 2002
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <jwz@lucid.com>
@@ -10,7 +10,7 @@
 
 ;;; This version incorporates changes up to version 2.10 of the
 ;;; Zawinski-Furuseth compiler.
-(defconst byte-compile-version "$Revision: 2.94 $")
+(defconst byte-compile-version "$Revision: 2.95 $")
 
 ;; This file is part of GNU Emacs.
 
@@ -1980,6 +1980,22 @@ list that represents a doc string reference.
               (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