changeset 94703:4520f20e7dd1

(ignore-errors): Move here from cl-macs.el.
author Glenn Morris <rgm@gnu.org>
date Wed, 07 May 2008 02:57:53 +0000
parents 80bd1cb865de
children be582a862bb9
files lisp/subr.el
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Wed May 07 02:56:35 2008 +0000
+++ b/lisp/subr.el	Wed May 07 02:57:53 2008 +0000
@@ -202,6 +202,11 @@
 Treated as a declaration when used at the right place in a
 `defmacro' form.  \(See Info anchor `(elisp)Definition of declare'.)"
   nil)
+
+(defmacro ignore-errors (&rest body)
+  "Execute BODY; if an error occurs, return nil.
+Otherwise, return result of last form in BODY."
+  `(condition-case nil (progn ,@body) (error nil)))
 
 ;;;; Basic Lisp functions.