From: Stefan Monnier Date: Fri, 15 Jun 2012 03:18:14 +0000 (-0400) Subject: * lisp/emacs-lisp/cl-lib.el (cl--defsubst-expand): Autoload inliner. X-Git-Tag: emacs-24.2.90~1199^2~472 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f38ea36d3d9415aeaf895ea7b439c41ee441c500;p=emacs.git * 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 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b1798cb6503..a56eb67e297 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2012-06-15 Stefan Monnier + * emacs-lisp/cl-lib.el (cl--defsubst-expand): Autoload inliner + (bug#11649). + + * emacs-lisp/macroexp.el (macroexp--compiler-macro): New function. + (macroexp--expand-all): Use it. + * emacs-lisp/cl-macs.el (cl--transform-function-property): Remove. (cl-define-setf-expander, cl-deftype, cl-define-compiler-macro): 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." ;;;###autoload (progn + ;; Make sure functions defined with cl-defsubst can be inlined even in + ;; packages which do not require CL. + (autoload 'cl--defsubst-expand "cl-macs") ;; Autoload, so autoload.el and font-lock can use it even when CL ;; is not loaded. (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." (macroexp--all-forms clause skip) clause))) +(defun macroexp--compiler-macro (handler form) + (condition-case err + (apply handler form (cdr form)) + (error (message "Compiler-macro error for %S: %S" (car form) err) + form)))) + (defun macroexp--expand-all (form) "Expand all macros in FORM. This is an internal version of `macroexpand-all'. @@ -198,20 +204,14 @@ Assumes the caller has bound `macroexpand-all-environment'." (ignore-errors (load (nth 1 (symbol-function func)) 'noerror 'nomsg))) - (let ((newform (condition-case err - (apply handler form (cdr form)) - (error (message "Compiler-macro error: %S" err) - form)))) + (let ((newform (macroexp--compiler-macro handler form))) (if (eq form newform) ;; The compiler macro did not find anything to do. (if (equal form (setq newform (macroexp--all-forms form 1))) form ;; Maybe after processing the args, some new opportunities ;; appeared, so let's try the compiler macro again. - (setq form (condition-case err - (apply handler newform (cdr newform)) - (error (message "Compiler-macro error: %S" err) - newform))) + (setq form (macroexp--compiler-macro handler newform)) (if (eq newform form) newform (macroexp--expand-all newform)))