]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 18 Aug 2010 10:21:43 +0000 (12:21 +0200)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 18 Aug 2010 10:21:43 +0000 (12:21 +0200)
declarations that are useful before running the macro.
* src/eval.c (Fdefmacro): Only obey one declaration.

lisp/ChangeLog
lisp/emacs-lisp/autoload.el
src/ChangeLog
src/eval.c

index 6a92ea844aa83c81a00afb2473d7ac8a7997a032..884427a1af100a361aa1b29556f230ec9121c850 100644 (file)
@@ -1,3 +1,8 @@
+2010-08-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/autoload.el (make-autoload): Preload the macros's
+       declarations that are useful before running the macro.
+
 2010-08-18  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * image.el (create-animated-image): Don't add heuristic mask to image
@@ -5,8 +10,8 @@
 
 2010-08-18  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * term/ns-win.el (ns-get-pasteboard, ns-set-pasteboard): Use
-       QCLIPBOARD instead of QPRIMARY (Bug#6677).
+       * term/ns-win.el (ns-get-pasteboard, ns-set-pasteboard):
+       Use QCLIPBOARD instead of QPRIMARY (Bug#6677).
 
 2010-08-17  Stefan Monnier  <monnier@iro.umontreal.ca>
 
index c5316d06429a6c2faac9fa034268a0c10846be97..6951e90c8b4ce3240fea60565ccce2cb59fe6c50 100644 (file)
@@ -109,29 +109,48 @@ or macro definition or a defcustom)."
       (let* ((macrop (memq car '(defmacro defmacro*)))
             (name (nth 1 form))
             (args (case car
-                   ((defun defmacro defun* defmacro*
-                      define-overloadable-function) (nth 2 form))
-                   ((define-skeleton) '(&optional str arg))
-                   ((define-generic-mode define-derived-mode
-                       define-compilation-mode) nil)
-                   (t)))
+                     ((defun defmacro defun* defmacro*
+                        define-overloadable-function) (nth 2 form))
+                     ((define-skeleton) '(&optional str arg))
+                     ((define-generic-mode define-derived-mode
+                        define-compilation-mode) nil)
+                     (t)))
             (body (nthcdr (get car 'doc-string-elt) form))
             (doc (if (stringp (car body)) (pop body))))
        (when (listp args)
          ;; Add the usage form at the end where describe-function-1
          ;; can recover it.
          (setq doc (help-add-fundoc-usage doc args)))
-       ;; `define-generic-mode' quotes the name, so take care of that
-       (list 'autoload (if (listp name) name (list 'quote name)) file doc
-             (or (and (memq car '(define-skeleton define-derived-mode
-                                   define-generic-mode
-                                   easy-mmode-define-global-mode
-                                   define-global-minor-mode
-                                   define-globalized-minor-mode
-                                   easy-mmode-define-minor-mode
-                                   define-minor-mode)) t)
-                 (eq (car-safe (car body)) 'interactive))
-             (if macrop (list 'quote 'macro) nil))))
+        (let ((exp
+               ;; `define-generic-mode' quotes the name, so take care of that
+               (list 'autoload (if (listp name) name (list 'quote name))
+                     file doc
+                     (or (and (memq car '(define-skeleton define-derived-mode
+                                           define-generic-mode
+                                           easy-mmode-define-global-mode
+                                           define-global-minor-mode
+                                           define-globalized-minor-mode
+                                           easy-mmode-define-minor-mode
+                                           define-minor-mode)) t)
+                         (eq (car-safe (car body)) 'interactive))
+                     (if macrop (list 'quote 'macro) nil))))
+          (when macrop
+            ;; Special case to autoload some of the macro's declarations.
+            (let ((decls (nth (if (stringp (nth 3 form)) 4 3) form))
+                  (exps '()))
+              (when (eq (car decls) 'declare)
+                ;; FIXME: We'd like to reuse macro-declaration-function,
+                ;; but we can't since it doesn't return anything.
+                (dolist (decl decls)
+                  (case (car-safe decl)
+                    (indent
+                     (push `(put ',name 'lisp-indent-function ',(cadr decl))
+                           exps))
+                    (doc-string
+                     (push `(put ',name 'doc-string-elt ',(cadr decl)) exps))))
+                (when exps
+                  (setq exp `(progn ,exp ,@exps))))))
+          exp)))
 
      ;; For defclass forms, use `eieio-defclass-autoload'.
      ((eq car 'defclass)
index aa3e239aeec4ac88301b4c919d6671e99cc34ce2..45cccea1ebb0ea837db15fe80171641cf0c1d776 100644 (file)
@@ -1,5 +1,7 @@
 2010-08-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * eval.c (Fdefmacro): Only obey one declaration.
+
        * casefiddle.c (casify_region): Setup gl_state.
 
 2010-08-18  Jan Djärv  <jan.h.d@swipnet.se>
index f127ef03293dcd7b73050d075ee861824d9ba6e1..5c6b268187b955bb13996ddeaa4f0de4c3c232c1 100644 (file)
@@ -690,8 +690,8 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...)  */)
       tail = XCDR (tail);
     }
 
-  while (CONSP (Fcar (tail))
-        && EQ (Fcar (Fcar (tail)), Qdeclare))
+  if (CONSP (Fcar (tail))
+      && EQ (Fcar (Fcar (tail)), Qdeclare))
     {
       if (!NILP (Vmacro_declaration_function))
        {