2011-11-21 Lars Magne Ingebrigtsen <larsi@gnus.org>
+ * dgnushack.el (fboundp): Define `with-demoted-errors' for Emacsen that
+ doesn't have it.
+
* mm-view.el (mm-display-inline-fontify): Make the font-lock variables
buffer-local instead of binding them to avoid warnings. Also demote
errors (bug#10063).
(error (princ "failed\n")))))
(setq path (cdr path))))))
+(unless (fboundp 'with-demoted-errors)
+ (defmacro with-demoted-errors (&rest body)
+ "Run BODY and demote any errors to simple messages.
+If `debug-on-error' is non-nil, run BODY without catching its errors.
+This is to be used around code which is not expected to signal an error
+but which should be robust in the unexpected case that an error is signaled."
+ (declare (debug t) (indent 0))
+ (let ((err (make-symbol "err")))
+ `(condition-case-no-debug ,err
+ (progn ,@body)
+ (error (message "Error: %S" ,err) nil)))))
+
;;; dgnushack.el ends here