Subject: bug#36772: feature request: checked variant of "substitute*"

From: Ricardo Wurmus <[email-masked]>
Date: Tue, 23 Jul 2019 15:35:19 +0200

Hi Robert,

> I think it would be great to have the following variant of substitute*:
>
> (substitute*-once filename (pattern vars) body)
>
> which acts like the usual substitute-*, except it also asserts that the
> substitution applies to exactly one line in the file, causing a build
> failure otherwise.

I agree that the effect of substitute* should be checked.  I think
substitute* should fail when one of its clauses failed to match
anything.

Each clause could also accept an optional argument to make them only
match one location.  We wouldn’t have to duplicate the macro for that
and it’s a simple extension to failing on zero matches.

What do you think?

--
Ricardo