(Handling Errors): Document ignore-errors.
authorEli Zaretskii <eliz@gnu.org>
Wed, 15 Oct 2008 12:49:11 +0000 (12:49 +0000)
committerEli Zaretskii <eliz@gnu.org>
Wed, 15 Oct 2008 12:49:11 +0000 (12:49 +0000)
doc/lispref/ChangeLog
doc/lispref/control.texi
etc/NEWS

index 84884e3..4217dc7 100644 (file)
@@ -1,5 +1,7 @@
 2008-10-15  Eli Zaretskii  <eliz@gnu.org>
 
+       * control.texi (Handling Errors): Document ignore-errors.
+
        * frames.texi (Creating Frames): Document frame-inherited-parameters.
        (Parameter Access): Document set-frame-parameter.
 
index 1ff1f89..8662732 100644 (file)
@@ -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
index ea0a76e..5f6b67a 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1128,6 +1128,7 @@ applies before function-key-map.  Also it is terminal-local contrary to
 key-translation-map.  Terminal-specific key-sequences are generally added to
 this map rather than to function-key-map now.
 
++++
 ** `ignore-errors' is now a standard macro (does not require the CL package).
 
 ** `interprogram-paste-function' can now return one string or a list