diff options
| author | Glenn Morris | 2014-01-23 20:11:48 -0800 |
|---|---|---|
| committer | Glenn Morris | 2014-01-23 20:11:48 -0800 |
| commit | 1e548e4056d46414fa30bb6cab1c660fa30ac905 (patch) | |
| tree | 0d72443d74fad7f47306fb08f302401ca68f3af1 | |
| parent | 96c983e0d3034ae09406c4b1fb76ca4d06008fcf (diff) | |
| download | emacs-1e548e4056d46414fa30bb6cab1c660fa30ac905.tar.gz emacs-1e548e4056d46414fa30bb6cab1c660fa30ac905.zip | |
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.
| -rw-r--r-- | doc/lispref/ChangeLog | 2 | ||||
| -rw-r--r-- | doc/lispref/control.texi | 7 | ||||
| -rw-r--r-- | etc/NEWS | 1 | ||||
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/subr.el | 4 |
5 files changed, 16 insertions, 2 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index cbbf9127235..6f27e71b7b7 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2014-01-24 Glenn Morris <rgm@gnu.org> | 1 | 2014-01-24 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * control.texi (Handling Errors): Update with-demoted-errors. | ||
| 4 | |||
| 3 | * files.texi (File Locks): Every platform supports locking now. | 5 | * files.texi (File Locks): Every platform supports locking now. |
| 4 | 6 | ||
| 5 | 2014-01-22 Glenn Morris <rgm@gnu.org> | 7 | 2014-01-22 Glenn Morris <rgm@gnu.org> |
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index 0d6aaff81c5..edf60dd5cc8 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi | |||
| @@ -1252,10 +1252,13 @@ Here's the example at the beginning of this subsection rewritten using | |||
| 1252 | @end example | 1252 | @end example |
| 1253 | @end defmac | 1253 | @end defmac |
| 1254 | 1254 | ||
| 1255 | @defmac with-demoted-errors body@dots{} | 1255 | @defmac with-demoted-errors format body@dots{} |
| 1256 | This macro is like a milder version of @code{ignore-errors}. Rather | 1256 | This macro is like a milder version of @code{ignore-errors}. Rather |
| 1257 | than suppressing errors altogether, it converts them into messages. | 1257 | than suppressing errors altogether, it converts them into messages. |
| 1258 | Use this form around code that is not expected to signal errors, but | 1258 | It uses the string @var{format} to format the message. |
| 1259 | @var{format} should contain a single @samp{%}-sequence; e.g., | ||
| 1260 | @code{"Error: %S"}. Use @code{with-demoted-errors} around code | ||
| 1261 | that is not expected to signal errors, but | ||
| 1259 | should be robust if one does occur. Note that this macro uses | 1262 | should be robust if one does occur. Note that this macro uses |
| 1260 | @code{condition-case-unless-debug} rather than @code{condition-case}. | 1263 | @code{condition-case-unless-debug} rather than @code{condition-case}. |
| 1261 | @end defmac | 1264 | @end defmac |
| @@ -1080,6 +1080,7 @@ displaying the buffer in a window. | |||
| 1080 | +++ | 1080 | +++ |
| 1081 | *** New function `define-error'. | 1081 | *** New function `define-error'. |
| 1082 | 1082 | ||
| 1083 | +++ | ||
| 1083 | *** `with-demoted-errors' takes an additional argument `format'. | 1084 | *** `with-demoted-errors' takes an additional argument `format'. |
| 1084 | 1085 | ||
| 1085 | +++ | 1086 | +++ |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 738fe6d37be..6743a537744 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-01-24 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * subr.el (with-demoted-errors): Doc fix. | ||
| 4 | |||
| 1 | 2014-01-23 Stefan Monnier <monnier@iro.umontreal.ca> | 5 | 2014-01-23 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 6 | ||
| 3 | * emacs-lisp/cl-macs.el: Improve type->predicate mapping (bug#16520). | 7 | * emacs-lisp/cl-macs.el: Improve type->predicate mapping (bug#16520). |
diff --git a/lisp/subr.el b/lisp/subr.el index 6709ebf0d02..e3cc4b05f3f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -3246,9 +3246,13 @@ even if this catches the signal." | |||
| 3246 | 3246 | ||
| 3247 | (defmacro with-demoted-errors (format &rest body) | 3247 | (defmacro with-demoted-errors (format &rest body) |
| 3248 | "Run BODY and demote any errors to simple messages. | 3248 | "Run BODY and demote any errors to simple messages. |
| 3249 | FORMAT is a string passed to `message' to format any error message. | ||
| 3250 | It should contain a single %-sequence; e.g., \"Error: %S\". | ||
| 3251 | |||
| 3249 | If `debug-on-error' is non-nil, run BODY without catching its errors. | 3252 | If `debug-on-error' is non-nil, run BODY without catching its errors. |
| 3250 | This is to be used around code which is not expected to signal an error | 3253 | This is to be used around code which is not expected to signal an error |
| 3251 | but which should be robust in the unexpected case that an error is signaled. | 3254 | but which should be robust in the unexpected case that an error is signaled. |
| 3255 | |||
| 3252 | For backward compatibility, if FORMAT is not a constant string, it | 3256 | For backward compatibility, if FORMAT is not a constant string, it |
| 3253 | is assumed to be part of BODY, in which case the message format | 3257 | is assumed to be part of BODY, in which case the message format |
| 3254 | used is \"Error: %S\"." | 3258 | used is \"Error: %S\"." |