-(defmacro report-errors (format &rest body)
- "Eval BODY and turn any error into a FORMAT message.
-FORMAT can have a %s escape which will be replaced with the actual error.
-If `debug-on-error' is set, errors are not caught, so that you can
-debug them.
-Avoid using a large BODY since it is duplicated."
- (declare (debug t) (indent 1))
- `(if debug-on-error
- (progn . ,body)
- (condition-case err
- (progn . ,body)
- (error (message ,format (prin1-to-string err))))))