From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mF6ZJHcVlWGZBAEAgWs5BA (envelope-from ) for ; Wed, 17 Nov 2021 15:45:11 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id WD5JIHcVlWHbIgAA1q6Kng (envelope-from ) for ; Wed, 17 Nov 2021 14:45:11 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4107AEC37 for ; Wed, 17 Nov 2021 15:45:11 +0100 (CET) Received: from localhost ([::1]:51952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnMBS-00008c-B5 for larch@yhetil.org; Wed, 17 Nov 2021 09:45:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnMBL-00005k-Qx for guix-patches@gnu.org; Wed, 17 Nov 2021 09:45:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49043) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnMBK-0000QP-IT for guix-patches@gnu.org; Wed, 17 Nov 2021 09:45:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mnMBK-0005Yf-G6 for guix-patches@gnu.org; Wed, 17 Nov 2021 09:45:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51922] [PATCH 1/2] guix: Add syntax to capture arguments' syntax-properties. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 17 Nov 2021 14:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51922 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51922@debbugs.gnu.org Cc: Josselin Poiret Received: via spool by 51922-submit@debbugs.gnu.org id=B51922.163716025021252 (code B ref 51922); Wed, 17 Nov 2021 14:45:02 +0000 Received: (at 51922) by debbugs.gnu.org; 17 Nov 2021 14:44:10 +0000 Received: from localhost ([127.0.0.1]:60588 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnMAT-0005Wi-US for submit@debbugs.gnu.org; Wed, 17 Nov 2021 09:44:10 -0500 Received: from jpoiret.xyz ([206.189.101.64]:38756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnMAE-0005VO-KV for 51922@debbugs.gnu.org; Wed, 17 Nov 2021 09:44:09 -0500 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 90EC7184F27; Wed, 17 Nov 2021 14:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1637160233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=USvYSL062ojHkz9dUzW/1zoI/XnS8Kkpuy1Y4EwS+ps=; b=uDcOycI5hyqjnNV/7m7jqt+h2RXBdcvucm0ntlPHiW2hNaP6m9huVxfdv2Q0wWeuVIWRd5 w+3fGXpeLjBCZKJI1owNO4dJIxNXJbQkmyhRfS9X9TgrPk7XW+2GXYh3V9W0TmuSNRaZWj yEj+O8Oz0hSnWAdK09Ztiox0cThUVenJY/8978UMc3F/w8mphEeG4dbs8ATV28OK5iohmu j3HRypfaBc1WTg+GYg7ATWNnMwaHcZd+qYF0Mt/9GoTivaCkc/xGJlVkxbNvdK1NbVYn0Y bNQEnAG0eOSrEvFdUP3Uv60e4AJZmFlNZKCvvTNv4qzC+Zx058ixKvlVrdsMBA== Date: Wed, 17 Nov 2021 14:43:47 +0000 Message-Id: <20211117144348.17090-1-dev@jpoiret.xyz> In-Reply-To: <20211117144028.16722-1-dev@jpoiret.xyz> References: <20211117144028.16722-1-dev@jpoiret.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Bar: / X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches From: Josselin Poiret via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1637160311; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=USvYSL062ojHkz9dUzW/1zoI/XnS8Kkpuy1Y4EwS+ps=; b=kLq1wCFapMB725L+5r9xjSD/WZCBZv31NvTBUbJOCmOtDLn6Kg37eoBXQk/eEATzApZTXj ewbscEbuLNEBttBCTtj9nik5ZskqE5jNgc8/DfBp2SVmFnK6Q475Du94vj93raCssIzL9W RpFhqhTCVgsaVYfjK3AV7VIZrp2aNsCqyi1R22Uvbef+8x38vTFPY1GCM/1P7k83LtaMLU qop/WCO8eOKmx4NkqhjHcWgdgRwe8s5l+Cz1+nVHO5lZAEjcJrbapRF/WwGvqSDwV4TgPa GXJxWMcApjpxcNL7kPEQZEftS+1qgdhReUpsS/lwVKN+zp0zRn+8rlIZDzu/HQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637160311; a=rsa-sha256; cv=none; b=pwid01vgHQAZwt6fh2NsG4+LVZrdH20gZ39JF9uupljn6kzAi8vDwJopvKXy00Pg6hl/// HCx7zjNhP2LQy9wdwpZvo8Apd4j6X+3kr/TTIDpv3RYFJ4etH+HTG24pI5zbgnB/ZWjXGP nhvIR/XFpdsyGfWdRQhOx9uj2JUX5zHQirtWUdgACaDZoSOwMHlFpuWqTyzRcF/4tLFrhH HAq4OEbq40Yi/6DIWeeFIpzUHkPdt10NN83jBJs0aoa5xZ3o15Kf8hdqtxPTb5M6sS98vk 5O4MOAYY6LeKC6FxSjZRcd+1jxvZ+YyJVgRMRtbglNZ6FhTCGsItFaJOz/l7fw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=uDcOycI5; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.35 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=uDcOycI5; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4107AEC37 X-Spam-Score: -1.35 X-Migadu-Scanner: scn0.migadu.com X-TUID: LSU5Ng5NB/3C * guix/diagnostics.scm (define-with-syntax-properties): Add it. --- guix/diagnostics.scm | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/guix/diagnostics.scm b/guix/diagnostics.scm index 6a792febd4..337a73c1a2 100644 --- a/guix/diagnostics.scm +++ b/guix/diagnostics.scm @@ -54,7 +54,9 @@ (define-module (guix diagnostics) condition-fix-hint guix-warning-port - program-name)) + program-name + + define-with-syntax-properties)) ;;; Commentary: ;;; @@ -331,3 +333,37 @@ (define guix-warning-port (define program-name ;; Name of the command-line program currently executing, or #f. (make-parameter #f)) + + +(define-syntax define-with-syntax-properties + (lambda (x) + "Define BINDING to be a syntax form replacing each VALUE-IDENTIFIER and +SYNTAX-PROPERTIES-IDENTIFIER in body by the syntax and syntax-properties, +respectively, of each ensuing syntax object." + (syntax-case x () + ((_ (binding (value-identifier syntax-properties-identifier) + ...) + body ...) + (and (and-map identifier? #'(value-identifier ...)) + (and-map identifier? #'(syntax-properties-identifier ...))) + #'(define-syntax binding + (lambda (y) + (with-ellipsis ::: + (syntax-case y () + ((_ value-identifier ...) + (with-syntax ((syntax-properties-identifier + #`'#,(datum->syntax y + (syntax-source + #'value-identifier))) + ...) + #'(begin body ...))) + (_ + (syntax-violation #f (format #f + "Expected (~a~{ ~a~})" + 'binding + '(value-identifier ...)) + y))))))) + (_ + (syntax-violation #f "Expected a definition of the form \ +(define-with-syntax-properties (binding (value syntax-properties) \ +...) body ...)" x))))) -- 2.33.1