]> code.delx.au - gnu-emacs/blobdiff - doc/lispref/control.texi
Updates to Documentation chapter of Lisp manual.
[gnu-emacs] / doc / lispref / control.texi
index 3371773b399706e978d068746b5fa34f9a37fab0..c23c93300a6a03285c307229e778534e6afb530f 100644 (file)
@@ -1,7 +1,6 @@
 @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, 2008, 2009, 2010, 2011  Free Software Foundation, Inc.
+@c Copyright (C) 1990-1995, 1998-1999, 2001-2012  Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../../info/control
 @node Control Structures, Variables, Evaluation, Top
@@ -9,11 +8,11 @@
 @cindex special forms for control structures
 @cindex control structures
 
-  A Lisp program consists of expressions or @dfn{forms} (@pxref{Forms}).
-We control the order of execution of these forms by enclosing them in
-@dfn{control structures}.  Control structures are special forms which
-control when, whether, or how many times to execute the forms they
-contain.
+  A Lisp program consists of a set of @dfn{expressions}, or
+@dfn{forms} (@pxref{Forms}).  We control the order of execution of
+these forms by enclosing them in @dfn{control structures}.  Control
+structures are special forms which control when, whether, or how many
+times to execute the forms they contain.
 
 @cindex textual order
   The simplest order of execution is sequential execution: first form
@@ -624,7 +623,7 @@ error is signaled with data @code{(@var{tag} @var{value})}.
 @subsection Examples of @code{catch} and @code{throw}
 
   One way to use @code{catch} and @code{throw} is to exit from a doubly
-nested loop.  (In most languages, this would be done with a ``go to.'')
+nested loop.  (In most languages, this would be done with a ``goto.'')
 Here we compute @code{(foo @var{i} @var{j})} for @var{i} and @var{j}
 varying from 0 to 9:
 
@@ -892,9 +891,8 @@ 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@footnote{
-Actually, you should use @code{ignore-errors} in such a simple case;
-see below.}.
+returning @code{nil} if an error occurs.  (You can use the macro
+@code{ignore-errors} for a simple case like this; 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
@@ -950,6 +948,13 @@ The effect of @code{debug} here is only to prevent
 given error will invoke the debugger only if @code{debug-on-error} and
 the other usual filtering mechanisms say it should.  @xref{Error Debugging}.
 
+@defmac condition-case-unless-debug var protected-form handlers@dots{}
+The macro @code{condition-case-unless-debug} provides another way to
+handle debugging of such forms.  It behaves exactly like
+@code{condition-case}, unless the variable @code{debug-on-error} is
+non-@code{nil}, in which case it does not handle any errors at all.
+@end defmac
+
   Once Emacs decides that a certain handler handles the error, it
 returns control to that handler.  To do so, Emacs unbinds all variable
 bindings made by binding constructs that are being exited, and
@@ -1123,6 +1128,13 @@ Here's the example at the beginning of this subsection rewritten using
 @end smallexample
 @end defmac
 
+@defmac with-demoted-errors body@dots{}
+This macro is like a milder version of @code{ignore-errors}.  Rather
+than suppressing errors altogether, it converts them into messages.
+Use this form around code that is not expected to signal errors, but
+should be robust if one does occur.  Note that this macro uses
+@code{condition-case-unless-debug} rather than @code{condition-case}.
+@end defmac
 
 @node Error Symbols
 @subsubsection Error Symbols and Condition Names