aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2012-06-14 23:18:14 -0400
committerStefan Monnier2012-06-14 23:18:14 -0400
commitf38ea36d3d9415aeaf895ea7b439c41ee441c500 (patch)
tree3dfb3b74fea3209bc021999edf7f75dbfa1ae3d0
parent2d7b84eab6a10752713af889f291c046eed33677 (diff)
downloademacs-f38ea36d3d9415aeaf895ea7b439c41ee441c500.tar.gz
emacs-f38ea36d3d9415aeaf895ea7b439c41ee441c500.zip
* lisp/emacs-lisp/cl-lib.el (cl--defsubst-expand): Autoload inliner.
* lisp/emacs-lisp/macroexp.el (macroexp--compiler-macro): New function. (macroexp--expand-all): Use it. Fixes: debbugs:11649
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/emacs-lisp/cl-lib.el3
-rw-r--r--lisp/emacs-lisp/macroexp.el16
3 files changed, 17 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b1798cb6503..a56eb67e297 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
12012-06-15 Stefan Monnier <monnier@iro.umontreal.ca> 12012-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/cl-lib.el (cl--defsubst-expand): Autoload inliner
4 (bug#11649).
5
6 * emacs-lisp/macroexp.el (macroexp--compiler-macro): New function.
7 (macroexp--expand-all): Use it.
8
3 * emacs-lisp/cl-macs.el (cl--transform-function-property): Remove. 9 * emacs-lisp/cl-macs.el (cl--transform-function-property): Remove.
4 (cl-define-setf-expander, cl-deftype, cl-define-compiler-macro): 10 (cl-define-setf-expander, cl-deftype, cl-define-compiler-macro):
5 Use `cl-function' instead. 11 Use `cl-function' instead.
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 223067c600f..bf7f6232ab7 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -641,6 +641,9 @@ If ALIST is non-nil, the new pairs are prepended to it."
641 641
642;;;###autoload 642;;;###autoload
643(progn 643(progn
644 ;; Make sure functions defined with cl-defsubst can be inlined even in
645 ;; packages which do not require CL.
646 (autoload 'cl--defsubst-expand "cl-macs")
644 ;; Autoload, so autoload.el and font-lock can use it even when CL 647 ;; Autoload, so autoload.el and font-lock can use it even when CL
645 ;; is not loaded. 648 ;; is not loaded.
646 (put 'cl-defun 'doc-string-elt 3) 649 (put 'cl-defun 'doc-string-elt 3)
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 8effb3c8e31..85e9b073158 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -94,6 +94,12 @@ each clause."
94 (macroexp--all-forms clause skip) 94 (macroexp--all-forms clause skip)
95 clause))) 95 clause)))
96 96
97(defun macroexp--compiler-macro (handler form)
98 (condition-case err
99 (apply handler form (cdr form))
100 (error (message "Compiler-macro error for %S: %S" (car form) err)
101 form))))
102
97(defun macroexp--expand-all (form) 103(defun macroexp--expand-all (form)
98 "Expand all macros in FORM. 104 "Expand all macros in FORM.
99This is an internal version of `macroexpand-all'. 105This is an internal version of `macroexpand-all'.
@@ -198,20 +204,14 @@ Assumes the caller has bound `macroexpand-all-environment'."
198 (ignore-errors 204 (ignore-errors
199 (load (nth 1 (symbol-function func)) 205 (load (nth 1 (symbol-function func))
200 'noerror 'nomsg))) 206 'noerror 'nomsg)))
201 (let ((newform (condition-case err 207 (let ((newform (macroexp--compiler-macro handler form)))
202 (apply handler form (cdr form))
203 (error (message "Compiler-macro error: %S" err)
204 form))))
205 (if (eq form newform) 208 (if (eq form newform)
206 ;; The compiler macro did not find anything to do. 209 ;; The compiler macro did not find anything to do.
207 (if (equal form (setq newform (macroexp--all-forms form 1))) 210 (if (equal form (setq newform (macroexp--all-forms form 1)))
208 form 211 form
209 ;; Maybe after processing the args, some new opportunities 212 ;; Maybe after processing the args, some new opportunities
210 ;; appeared, so let's try the compiler macro again. 213 ;; appeared, so let's try the compiler macro again.
211 (setq form (condition-case err 214 (setq form (macroexp--compiler-macro handler newform))
212 (apply handler newform (cdr newform))
213 (error (message "Compiler-macro error: %S" err)
214 newform)))
215 (if (eq newform form) 215 (if (eq newform form)
216 newform 216 newform
217 (macroexp--expand-all newform))) 217 (macroexp--expand-all newform)))