Subject: Re: bug#54225: [PATCH] with-demoted-errors: Fix macroexp-warn-and-return call

From: Michael Heerdegen <[email-masked]>
Date: Fri, 04 Mar 2022 01:21:58 +0100

Lars Ingebrigtsen <[email-masked]> writes:

> The code flow in with-demoted-errors is pretty confusing.  Can it be
> improved upon instead of tweaked this way?

Yesterday I dealt with that, and I think I understood most parts: the
code is a bit ugly but necessarily because the semantics are (also
necessarily due to backwards compatibility).  The cases to be supported
are:

- FORMAT is a string (and BODY not empty) - the expected use case

- FORMAT is nil: that's equivalent to FORMAT being "Error: %S"

- Anything else: also use the above default format string but
  additionally add that sexp to the BODY since it's expected to be code
  (backwards compatibility).  It works but you get a warning.

Once the third case will not be supported any more the code can be made
much simpler.

Michael.