From 134b49544c7f140cf30c1874cfa64c491d5dbdbd Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Mon, 21 Nov 2011 21:10:51 +0100 Subject: [PATCH] * dgnushack.el (fboundp): Define `with-demoted-errors' for Emacsen that doesn't have it. --- lisp/ChangeLog | 3 +++ lisp/dgnushack.el | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e18789e65..8a9619dc6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2011-11-21 Lars Magne Ingebrigtsen + * 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). diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index e3110d737..987bb2865 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -549,4 +549,16 @@ or remove them using `make remove-installed-shadows'.\n\n")))))))) (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 -- 2.34.1