X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/b3843c61858aa78d450bdaaa2e597f0a1f7b39e4..5667b1b438c74309197305df8e30cb3c0b4e5826:/doc/lispref/control.texi diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index db88a74487..97e892b1c2 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -1,7 +1,7 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002, -@c 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +@c 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../../info/control @node Control Structures, Variables, Evaluation, Top @@ -803,7 +803,7 @@ error message is the @sc{car} of @var{data} (that must be a string). Subcategories of @code{file-error} are handled specially. The number and significance of the objects in @var{data} depends on -@var{error-symbol}. For example, with a @code{wrong-type-arg} error, +@var{error-symbol}. For example, with a @code{wrong-type-argument} error, there should be two objects in the list: a predicate that describes the type that was expected, and the object that failed to fit that type. @@ -891,7 +891,9 @@ establishing an error handler, with the special form @noindent This deletes the file named @var{filename}, catching any error and -returning @code{nil} if an error occurs. +returning @code{nil} if an error occurs@footnote{ +Actually, you should use @code{ignore-errors} in such a simple case; +see below.}. The @code{condition-case} construct is often used to trap errors that are predictable, such as failure to open a file in a call to @@ -1089,6 +1091,23 @@ including those signaled with @code{error}: @end group @end smallexample +@defmac ignore-errors body@dots{} +This construct executes @var{body}, ignoring any errors that occur +during its execution. If the execution is without error, +@code{ignore-errors} returns the value of the last form in @var{body}; +otherwise, it returns @code{nil}. + +Here's the example at the beginning of this subsection rewritten using +@code{ignore-errors}: + +@smallexample +@group + (ignore-errors + (delete-file filename)) +@end group +@end smallexample +@end defmac + @node Error Symbols @subsubsection Error Symbols and Condition Names @cindex error symbol