diff options
| author | Stefan Monnier | 2012-06-05 12:43:43 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-06-05 12:43:43 -0400 |
| commit | 53aacf21b41d567ff41cc33b91a44b018ceb4195 (patch) | |
| tree | eb9699724e8a1c9428d52acff05fef2d585f5820 | |
| parent | 57a7d50707c79e22f52a71d9c7f6d4a4773456c3 (diff) | |
| download | emacs-53aacf21b41d567ff41cc33b91a44b018ceb4195.tar.gz emacs-53aacf21b41d567ff41cc33b91a44b018ceb4195.zip | |
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Tolerate errors during
compiler-macro expansion.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-loaddefs.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/macroexp.el | 15 |
3 files changed, 15 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 38c4c74dab7..efae4584643 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2012-06-05 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2012-06-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * emacs-lisp/macroexp.el (macroexpand-all-1): Tolerate errors during | ||
| 4 | compiler-macro expansion. | ||
| 5 | |||
| 3 | Add native compiler-macro support. | 6 | Add native compiler-macro support. |
| 4 | * emacs-lisp/macroexp.el (macroexpand-all-1): | 7 | * emacs-lisp/macroexp.el (macroexpand-all-1): |
| 5 | Support compiler-macros directly. Properly follow aliases and apply | 8 | Support compiler-macros directly. Properly follow aliases and apply |
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el index 6d4f60b1029..d521ea32117 100644 --- a/lisp/emacs-lisp/cl-loaddefs.el +++ b/lisp/emacs-lisp/cl-loaddefs.el | |||
| @@ -289,7 +289,7 @@ This also does some trivial optimizations to make the form prettier. | |||
| 289 | ;;;;;; cl-return cl-block cl-etypecase cl-typecase cl-ecase cl-case | 289 | ;;;;;; cl-return cl-block cl-etypecase cl-typecase cl-ecase cl-case |
| 290 | ;;;;;; cl-load-time-value cl-eval-when cl-destructuring-bind cl-function | 290 | ;;;;;; cl-load-time-value cl-eval-when cl-destructuring-bind cl-function |
| 291 | ;;;;;; cl-defmacro cl-defun cl-gentemp cl-gensym) "cl-macs" "cl-macs.el" | 291 | ;;;;;; cl-defmacro cl-defun cl-gentemp cl-gensym) "cl-macs" "cl-macs.el" |
| 292 | ;;;;;; "35e128b3ab7780c4f9c25da5a0adea7a") | 292 | ;;;;;; "f3973150add70d26cadb8530147dfc99") |
| 293 | ;;; Generated autoloads from cl-macs.el | 293 | ;;; Generated autoloads from cl-macs.el |
| 294 | 294 | ||
| 295 | (autoload 'cl-gensym "cl-macs" "\ | 295 | (autoload 'cl-gensym "cl-macs" "\ |
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'." | |||
| 187 | (fboundp func) | 187 | (fboundp func) |
| 188 | (or (not (eq (car-safe (symbol-function func)) | 188 | (or (not (eq (car-safe (symbol-function func)) |
| 189 | 'autoload)) | 189 | 'autoload)) |
| 190 | (load (nth 1 (symbol-function func))))) | 190 | (ignore-errors |
| 191 | (load (nth 1 (symbol-function func)))))) | ||
| 191 | ;; Follow the sequence of aliases. | 192 | ;; Follow the sequence of aliases. |
| 192 | (setq func (symbol-function func))) | 193 | (setq func (symbol-function func))) |
| 193 | (if (null handler) | 194 | (if (null handler) |
| @@ -195,15 +196,21 @@ Assumes the caller has bound `macroexpand-all-environment'." | |||
| 195 | ;; setq/setq-default this works alright because the variable names | 196 | ;; setq/setq-default this works alright because the variable names |
| 196 | ;; are symbols). | 197 | ;; are symbols). |
| 197 | (macroexpand-all-forms form 1) | 198 | (macroexpand-all-forms form 1) |
| 198 | (let ((newform (apply handler form (cdr form)))) | 199 | (let ((newform (condition-case err |
| 200 | (apply handler form (cdr form)) | ||
| 201 | (error (message "Compiler-macro error: %S" err) | ||
| 202 | form)))) | ||
| 199 | (if (eq form newform) | 203 | (if (eq form newform) |
| 200 | ;; The compiler macro did not find anything to do. | 204 | ;; The compiler macro did not find anything to do. |
| 201 | (if (equal form (setq newform (macroexpand-all-forms form 1))) | 205 | (if (equal form (setq newform (macroexpand-all-forms form 1))) |
| 202 | form | 206 | form |
| 203 | ;; Maybe after processing the args, some new opportunities | 207 | ;; Maybe after processing the args, some new opportunities |
| 204 | ;; appeared, so let's try the compiler macro again. | 208 | ;; appeared, so let's try the compiler macro again. |
| 205 | (if (eq newform | 209 | (setq form (condition-case err |
| 206 | (setq form (apply handler newform (cdr newform)))) | 210 | (apply handler newform (cdr newform)) |
| 211 | (error (message "Compiler-macro error: %S" err) | ||
| 212 | newform))) | ||
| 213 | (if (eq newform form) | ||
| 207 | newform | 214 | newform |
| 208 | (macroexpand-all-1 newform))) | 215 | (macroexpand-all-1 newform))) |
| 209 | (macroexpand-all-1 newform)))))) | 216 | (macroexpand-all-1 newform)))))) |