aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2010-08-18 12:21:43 +0200
committerStefan Monnier2010-08-18 12:21:43 +0200
commit0193499fe1b0666b73bdd4a4e628e0af065ea42f (patch)
treeea5419d08ab50404dc7135215c33fc3e7e98d18d
parentc785836ddc6ac51fd46f4a476c75c3b2327cc2b0 (diff)
downloademacs-0193499fe1b0666b73bdd4a4e628e0af065ea42f.tar.gz
emacs-0193499fe1b0666b73bdd4a4e628e0af065ea42f.zip
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
declarations that are useful before running the macro. * src/eval.c (Fdefmacro): Only obey one declaration.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/emacs-lisp/autoload.el53
-rw-r--r--src/ChangeLog2
-rw-r--r--src/eval.c4
4 files changed, 47 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6a92ea844aa..884427a1af1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12010-08-18 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/autoload.el (make-autoload): Preload the macros's
4 declarations that are useful before running the macro.
5
12010-08-18 Katsumi Yamaoka <yamaoka@jpl.org> 62010-08-18 Katsumi Yamaoka <yamaoka@jpl.org>
2 7
3 * image.el (create-animated-image): Don't add heuristic mask to image 8 * image.el (create-animated-image): Don't add heuristic mask to image
@@ -5,8 +10,8 @@
5 10
62010-08-18 Jan Djärv <jan.h.d@swipnet.se> 112010-08-18 Jan Djärv <jan.h.d@swipnet.se>
7 12
8 * term/ns-win.el (ns-get-pasteboard, ns-set-pasteboard): Use 13 * term/ns-win.el (ns-get-pasteboard, ns-set-pasteboard):
9 QCLIPBOARD instead of QPRIMARY (Bug#6677). 14 Use QCLIPBOARD instead of QPRIMARY (Bug#6677).
10 15
112010-08-17 Stefan Monnier <monnier@iro.umontreal.ca> 162010-08-17 Stefan Monnier <monnier@iro.umontreal.ca>
12 17
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index c5316d06429..6951e90c8b4 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -109,29 +109,48 @@ or macro definition or a defcustom)."
109 (let* ((macrop (memq car '(defmacro defmacro*))) 109 (let* ((macrop (memq car '(defmacro defmacro*)))
110 (name (nth 1 form)) 110 (name (nth 1 form))
111 (args (case car 111 (args (case car
112 ((defun defmacro defun* defmacro* 112 ((defun defmacro defun* defmacro*
113 define-overloadable-function) (nth 2 form)) 113 define-overloadable-function) (nth 2 form))
114 ((define-skeleton) '(&optional str arg)) 114 ((define-skeleton) '(&optional str arg))
115 ((define-generic-mode define-derived-mode 115 ((define-generic-mode define-derived-mode
116 define-compilation-mode) nil) 116 define-compilation-mode) nil)
117 (t))) 117 (t)))
118 (body (nthcdr (get car 'doc-string-elt) form)) 118 (body (nthcdr (get car 'doc-string-elt) form))
119 (doc (if (stringp (car body)) (pop body)))) 119 (doc (if (stringp (car body)) (pop body))))
120 (when (listp args) 120 (when (listp args)
121 ;; Add the usage form at the end where describe-function-1 121 ;; Add the usage form at the end where describe-function-1
122 ;; can recover it. 122 ;; can recover it.
123 (setq doc (help-add-fundoc-usage doc args))) 123 (setq doc (help-add-fundoc-usage doc args)))
124 ;; `define-generic-mode' quotes the name, so take care of that 124 (let ((exp
125 (list 'autoload (if (listp name) name (list 'quote name)) file doc 125 ;; `define-generic-mode' quotes the name, so take care of that
126 (or (and (memq car '(define-skeleton define-derived-mode 126 (list 'autoload (if (listp name) name (list 'quote name))
127 define-generic-mode 127 file doc
128 easy-mmode-define-global-mode 128 (or (and (memq car '(define-skeleton define-derived-mode
129 define-global-minor-mode 129 define-generic-mode
130 define-globalized-minor-mode 130 easy-mmode-define-global-mode
131 easy-mmode-define-minor-mode 131 define-global-minor-mode
132 define-minor-mode)) t) 132 define-globalized-minor-mode
133 (eq (car-safe (car body)) 'interactive)) 133 easy-mmode-define-minor-mode
134 (if macrop (list 'quote 'macro) nil)))) 134 define-minor-mode)) t)
135 (eq (car-safe (car body)) 'interactive))
136 (if macrop (list 'quote 'macro) nil))))
137 (when macrop
138 ;; Special case to autoload some of the macro's declarations.
139 (let ((decls (nth (if (stringp (nth 3 form)) 4 3) form))
140 (exps '()))
141 (when (eq (car decls) 'declare)
142 ;; FIXME: We'd like to reuse macro-declaration-function,
143 ;; but we can't since it doesn't return anything.
144 (dolist (decl decls)
145 (case (car-safe decl)
146 (indent
147 (push `(put ',name 'lisp-indent-function ',(cadr decl))
148 exps))
149 (doc-string
150 (push `(put ',name 'doc-string-elt ',(cadr decl)) exps))))
151 (when exps
152 (setq exp `(progn ,exp ,@exps))))))
153 exp)))
135 154
136 ;; For defclass forms, use `eieio-defclass-autoload'. 155 ;; For defclass forms, use `eieio-defclass-autoload'.
137 ((eq car 'defclass) 156 ((eq car 'defclass)
diff --git a/src/ChangeLog b/src/ChangeLog
index aa3e239aeec..45cccea1ebb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,7 @@
12010-08-18 Stefan Monnier <monnier@iro.umontreal.ca> 12010-08-18 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * eval.c (Fdefmacro): Only obey one declaration.
4
3 * casefiddle.c (casify_region): Setup gl_state. 5 * casefiddle.c (casify_region): Setup gl_state.
4 6
52010-08-18 Jan Djärv <jan.h.d@swipnet.se> 72010-08-18 Jan Djärv <jan.h.d@swipnet.se>
diff --git a/src/eval.c b/src/eval.c
index f127ef03293..5c6b268187b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -690,8 +690,8 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */)
690 tail = XCDR (tail); 690 tail = XCDR (tail);
691 } 691 }
692 692
693 while (CONSP (Fcar (tail)) 693 if (CONSP (Fcar (tail))
694 && EQ (Fcar (Fcar (tail)), Qdeclare)) 694 && EQ (Fcar (Fcar (tail)), Qdeclare))
695 { 695 {
696 if (!NILP (Vmacro_declaration_function)) 696 if (!NILP (Vmacro_declaration_function))
697 { 697 {