From 866c1d22181fda6b0df3e9bf2c5f0bab9ee4a393 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 5 Feb 2012 16:48:02 -0800 Subject: [PATCH] Document yet more things that were never added to NEWS * doc/lispref/control.texi (Handling Errors): Mention condition-case-no-debug and with-demoted-errors. * etc/NEWS: Related edits. --- doc/lispref/ChangeLog | 5 +++++ doc/lispref/control.texi | 19 ++++++++++++++++--- etc/NEWS | 4 +++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 85dc017d7f5..933fe82f1e8 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2012-02-06 Glenn Morris + + * control.texi (Handling Errors): + Mention condition-case-no-debug and with-demoted-errors. + 2012-02-05 Chong Yidong * customize.texi (Common Keywords): Minor clarifications. diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index 0511f21007d..3673f753a0a 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -891,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 @@ -949,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-no-debug var protected-form handlers@dots{} +The macro @code{condition-case-no-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 @@ -1122,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-no-debug} rather than @code{condition-case}. +@end defmac @node Error Symbols @subsubsection Error Symbols and Condition Names diff --git a/etc/NEWS b/etc/NEWS index 2cdfcf1dad4..136ff60fec3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1244,7 +1244,9 @@ set of "wrapping" filters, similar to around advice. (A version of this macro was actually added in Emacs 23.2 but was not advertised at the time.) -** Macro `with-demoted-errors' was added in Emacs 23.1 but not advertised. ++++ +** The macros `condition-case-no-debug' and `with-demoted-errors' were +added in Emacs 23.1, but not advertised. +++ ** The new function `server-eval-at' allows evaluation of Lisp forms on -- 2.39.2