From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id IAOeB2WC82OcCQEAbAwnHQ (envelope-from ) for ; Mon, 20 Feb 2023 15:23:33 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id COZqBmWC82NvdgEAG6o9tA (envelope-from ) for ; Mon, 20 Feb 2023 15:23:33 +0100 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 C23CD22FF6 for ; Mon, 20 Feb 2023 15:23:32 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=KOIkUKTB; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676903012; a=rsa-sha256; cv=none; b=cwrZiAKjg6JUQjXeaEMc6e+DsSXokPP4mlh+BoayP2BZoAGhp+v5TzynOefD6jVks0kcpg wIGrKEAJb9sULKTvAOOcPAFgXl8TouevbCOrdt6qOXPggk2MtHPIAAAEIh1UIaXkrOkOIX nEqodjya6skh7x2Rp1n9hunp2M3r25ZNwn/s8a4fNNR2HVBkG1Qj7IEbnFgC3yPbV8naeK vIQRDh8RiykYleEefy0os7xD6grNGQfEsfurDIlTpqdiPUm628wWtjQ8xqKbcdM3+NSyn2 bVLp/xUePFzIHy69XYbZ4GU6B2DXqFctPUm14ZrHRXAsGCtUjWVgwXGBXRqjig== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=KOIkUKTB; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676903012; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=KtzJeA064KbhV9CxB7NFRXHMNozWPljyUgwaZxm6dqE=; b=ciszwzgz0+iT2H0By/wkTLANSFPhMQmrj1Iob86demRHUVhz+xE+2HcdSav3JDYgreir4j SjJ0Xg6x4RXbX59i908X2fcE7pfh52SGbyWaGsi6tCxez8sEw5wdnm1G3lVwL0ZJ4Oq/+X zei1EkV7IaI/2etNUKXLesxks5QItI3OZxEDeknLr3SKiIiwH2KsywNXZJ4RhJxcRHH5qU K6pFpCrT5Ycz0BWirxsP7N/7P0JKlrwdAc6BphGbhCK2ZQSzU7pXy6dT/rC+dGLaXRCpCH i/n9g89biKFxvu+3eGDdZsPG/kuQ4IEedlixVUu36UDv3iQ7Aqr/5qd0IzZ6tQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU73s-0005qf-CY; Mon, 20 Feb 2023 09:22:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU73q-0005qE-FA for emacs-orgmode@gnu.org; Mon, 20 Feb 2023 09:22:34 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU73o-0005cd-6U for emacs-orgmode@gnu.org; Mon, 20 Feb 2023 09:22:34 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id A6372240074 for ; Mon, 20 Feb 2023 15:22:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1676902949; bh=8KatmUng0xI7a2BekLYO0FNWsCXyqNrOBntFgmPzVIc=; h=From:To:Cc:Subject:Date:From; b=KOIkUKTBAKLqGgU6On0g1ZXxG1a80eH1FcBvXcvN8UAvvYKEG4VJa/j8Asi5lJfPp v4GuD+rZ7t1DBdmLHt0+31fYIzRvRESQFWOnUL6Ifb549oVhcP7XLB4lq23/orGpzH H+UmWM1l9mM90MhAz3RjSAP86BEBraS/MS32O8060gSb1/tQlZLjwIHvTB1hS6vRUh tpP6Hybbaev3pFRJbBP+QdQ8wtGovEzeT9/+d3Ou6e9Q7whKnpBL7CbY9zh47xmFyo eS2axt3uiw9XmdjP+WaT3S0kZhQFrXLiJEFKXZroP6Xck7uvENv+Pdnz5JPGYAKaUK FUsQmUXRBne4A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PL4Pc4qXXz6tmp; Mon, 20 Feb 2023 15:22:28 +0100 (CET) From: Ihor Radchenko To: =?utf-8?Q?Th=C3=A9o?= Maxime Tyburn Cc: emacs-orgmode@gnu.org Subject: Re: Multiple noweb-ref In-Reply-To: <87pmajxef5.fsf@gmail.com> References: <87pmajxef5.fsf@gmail.com> Date: Mon, 20 Feb 2023 14:23:07 +0000 Message-ID: <875ybwe7qs.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: X-Migadu-Queue-Id: C23CD22FF6 X-Spam-Score: -6.13 X-Migadu-Spam-Score: -6.13 X-Migadu-Scanner: scn0.migadu.com List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-TUID: fcKGqYGZgoIK Th=C3=A9o Maxime Tyburn writes: > What I would like to have, when I expand `<>` is to get all the bloc= ks > under A, and when I expand `<>` I get all the blocks under B. For > now when I expand `<>` I only get the blocks under A that are not un= der B. > > Is there a way to do this with the current features of org-babel? No, AFAIK. Not easily at least. > Anyway I tried to hack my way trough it. It seems there are two things > to do : > 1) Enable noweb-ref to contain multiple references. > 2) Accumulate references when using header-args+ or use tags to set the > value of noweb-ref > > I came up with a quick patch for 1): > modified lisp/ob-core.el > @@ -2910,8 +2910,11 @@ block but are passed literally to the \"example-bl= ock\"." > (if (org-in-commented-heading-p) > (org-forward-heading-same-level nil t) > (let* ((info (org-babel-get-src-block-info t)) > - (ref (cdr (assq :noweb-ref (nth 2 info))))) > - (push info (gethash ref cache)))))) > + (refs (cdr (assq :noweb-ref (nth 2 info))))) > + (if refs > + (dolist (ref (s-split "+" refs)) > + (push info (gethash ref cache))) > + (push info (gethash refs cache))))))) + is a bit awkward. Space would be more logical as separator. Though I am wondering if people are using noweb reference names with spaces in the wild. > Feedback on the code is of course very welcome. Not sure if using a plus > sign as a delimiter is clever. Also not sure if using `s-split` is a > good idea, what would be the builtin alternative? There is built-in `split-string'. > For 2) I didn't check in detail how one could achieve this. I have the > impression it would be easier to use tags. One could define a > new variable `org-babel-set-noweb-refs-from-tags` that would be used in > `org-babel-get-src-block-info` to generate the value of noweb-ref we > would like to have depending on the tags of the headline of the > block. I'll try this soonish. I do not like the idea of using tags. What we might do is: 1. Leave :noweb-ref's current behavior of overwriting the parent parameter values. 2. Add a new :noweb-ref+ parameter to accumulate multiple noweb reference names. The relevant function to modify is `org-babel-merge-params' --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at