Doc updates for with-demoted-errors

* doc/lispref/control.texi (Handling Errors): Update with-demoted-errors.

* lisp/subr.el (with-demoted-errors): Doc fix.

* etc/NEWS: Related edit.
This commit is contained in:
Glenn Morris 2014-01-23 20:11:48 -08:00
parent 96c983e0d3
commit 1e548e4056
5 changed files with 16 additions and 2 deletions

View file

@ -1,5 +1,7 @@
2014-01-24 Glenn Morris <rgm@gnu.org>
* control.texi (Handling Errors): Update with-demoted-errors.
* files.texi (File Locks): Every platform supports locking now.
2014-01-22 Glenn Morris <rgm@gnu.org>

View file

@ -1252,10 +1252,13 @@ Here's the example at the beginning of this subsection rewritten using
@end example
@end defmac
@defmac with-demoted-errors body@dots{}
@defmac with-demoted-errors format 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
It uses the string @var{format} to format the message.
@var{format} should contain a single @samp{%}-sequence; e.g.,
@code{"Error: %S"}. Use @code{with-demoted-errors} 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

View file

@ -1080,6 +1080,7 @@ displaying the buffer in a window.
+++
*** New function `define-error'.
+++
*** `with-demoted-errors' takes an additional argument `format'.
+++

View file

@ -1,3 +1,7 @@
2014-01-24 Glenn Morris <rgm@gnu.org>
* subr.el (with-demoted-errors): Doc fix.
2014-01-23 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/cl-macs.el: Improve type->predicate mapping (bug#16520).

View file

@ -3246,9 +3246,13 @@ even if this catches the signal."
(defmacro with-demoted-errors (format &rest body)
"Run BODY and demote any errors to simple messages.
FORMAT is a string passed to `message' to format any error message.
It should contain a single %-sequence; e.g., \"Error: %S\".
If `debug-on-error' is non-nil, run BODY without catching its errors.
This is to be used around code which is not expected to signal an error
but which should be robust in the unexpected case that an error is signaled.
For backward compatibility, if FORMAT is not a constant string, it
is assumed to be part of BODY, in which case the message format
used is \"Error: %S\"."