From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#36772: feature request: checked variant of "substitute*" Date: Thu, 25 Jul 2019 19:40:48 +0200 Message-ID: <875znqrp0f.fsf@gnu.org> References: <87zhl4c1rc.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:46417) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqhji-0005YX-Pa for bug-guix@gnu.org; Thu, 25 Jul 2019 13:41:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqhjh-0002zP-RM for bug-guix@gnu.org; Thu, 25 Jul 2019 13:41:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59819) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hqhjh-0002zB-Mt for bug-guix@gnu.org; Thu, 25 Jul 2019 13:41:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hqhjh-0004cl-JZ for bug-guix@gnu.org; Thu, 25 Jul 2019 13:41:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87zhl4c1rc.fsf@elephly.net> (Ricardo Wurmus's message of "Tue, 23 Jul 2019 15:35:19 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ricardo Wurmus Cc: 36772@debbugs.gnu.org, Robert Vollmert Hi, Ricardo Wurmus 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=E2=80=99t have to duplicate the macro for = that > and it=E2=80=99s a simple extension to failing on zero matches. > > What do you think? That=E2=80=99d be a useful extension. Ludo=E2=80=99.