diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-06-05 12:43:43 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-06-05 12:43:43 -0400 |
commit | 53aacf21b41d567ff41cc33b91a44b018ceb4195 (patch) | |
tree | eb9699724e8a1c9428d52acff05fef2d585f5820 /lisp/emacs-lisp/macroexp.el | |
parent | 57a7d50707c79e22f52a71d9c7f6d4a4773456c3 (diff) | |
download | emacs-53aacf21b41d567ff41cc33b91a44b018ceb4195.tar.gz emacs-53aacf21b41d567ff41cc33b91a44b018ceb4195.tar.bz2 emacs-53aacf21b41d567ff41cc33b91a44b018ceb4195.zip |
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Tolerate errors during
compiler-macro expansion.
Diffstat (limited to 'lisp/emacs-lisp/macroexp.el')
-rw-r--r-- | lisp/emacs-lisp/macroexp.el | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 953b4b7eab5..b021abe71ea 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -187,7 +187,8 @@ Assumes the caller has bound `macroexpand-all-environment'." (fboundp func) (or (not (eq (car-safe (symbol-function func)) 'autoload)) - (load (nth 1 (symbol-function func))))) + (ignore-errors + (load (nth 1 (symbol-function func)))))) ;; Follow the sequence of aliases. (setq func (symbol-function func))) (if (null handler) @@ -195,15 +196,21 @@ Assumes the caller has bound `macroexpand-all-environment'." ;; setq/setq-default this works alright because the variable names ;; are symbols). (macroexpand-all-forms form 1) - (let ((newform (apply handler form (cdr form)))) + (let ((newform (condition-case err + (apply handler form (cdr form)) + (error (message "Compiler-macro error: %S" err) + form)))) (if (eq form newform) ;; The compiler macro did not find anything to do. (if (equal form (setq newform (macroexpand-all-forms form 1))) form ;; Maybe after processing the args, some new opportunities ;; appeared, so let's try the compiler macro again. - (if (eq newform - (setq form (apply handler newform (cdr newform)))) + (setq form (condition-case err + (apply handler newform (cdr newform)) + (error (message "Compiler-macro error: %S" err) + newform))) + (if (eq newform form) newform (macroexpand-all-1 newform))) (macroexpand-all-1 newform)))))) |