[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36772: feature request: checked variant of "substitute*"
From: |
Ludovic Courtès |
Subject: |
bug#36772: feature request: checked variant of "substitute*" |
Date: |
Thu, 25 Jul 2019 19:40:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Hi,
Ricardo Wurmus <address@hidden> skribis:
>> 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?
That’d be a useful extension.
Ludo’.