Stefan Monnier via Mailing list for Emacs changes writes: > branch: master > commit d52c929e31f60ff0462371bfe27ebd479e3e82bd > Author: Stefan Monnier > Commit: Stefan Monnier > > (with-demoted-errors): Warn on missing `format` arg > > The `format` arg has been mandatory for a while, but the backward > compatibility code that handled the case of a missing `format` arg > made it hard to notice when using the old calling convention. > > * lisp/subr.el (with-demoted-errors): Warn on missing `format` arg. > [...] > diff --git a/lisp/subr.el b/lisp/subr.el > index a1eb6fe3af..0b546c0e0b 100644 > --- a/lisp/subr.el > +++ b/lisp/subr.el > @@ -4531,19 +4531,21 @@ 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 that is not expected to signal an error > -but that 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\"." > +but that should be robust in the unexpected case that an error is signaled." > (declare (debug t) (indent 1)) > - (let ((err (make-symbol "err")) > - (format (if (and (stringp format) body) format > - (prog1 "Error: %S" > - (if format (push format body)))))) > - `(condition-case-unless-debug ,err > - ,(macroexp-progn body) > - (error (message ,format ,err) nil)))) > + (let* ((err (make-symbol "err")) > + (orig-body body) > + (format (if (and (stringp format) body) format > + (prog1 "Error: %S" > + (if format (push format body))))) > + (exp > + `(condition-case-unless-debug ,err > + ,(macroexp-progn body) > + (error (message ,format ,err) nil)))) > + (if (eq orig-body body) exp > + ;; The use without `format' is obsolete, let's warn when we bump > + ;; into any such remaining uses. > + (macroexp-warn-and-return format "Missing format argument" exp)))) Since you explicitly allow FORMAT to be nil (standing for a default format string), and using this is quite handy, how about documenting the nil semantics? E.g. like