# HG changeset patch # User Eli Zaretskii # Date 1224074909 0 # Node ID 71fac6afda5e9d5019bbadf15bf03b9f3a705123 # Parent 6bc41dac432cae9bb7bc8237a04ec45bf9d06855 (Handling Errors): Document ignore-errors. diff -r 6bc41dac432c -r 71fac6afda5e doc/lispref/control.texi --- a/doc/lispref/control.texi Wed Oct 15 12:25:19 2008 +0000 +++ b/doc/lispref/control.texi Wed Oct 15 12:48:29 2008 +0000 @@ -891,7 +891,9 @@ @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 @@ @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