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 wCbEDqqaamJzAQEAbAwnHQ (envelope-from ) for ; Thu, 28 Apr 2022 15:46:18 +0200 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 6OnZDaqaamLqDAAAG6o9tA (envelope-from ) for ; Thu, 28 Apr 2022 15:46:18 +0200 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 C5037275C0 for ; Thu, 28 Apr 2022 15:46:17 +0200 (CEST) Received: from localhost ([::1]:44134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nk4T1-0007mC-AJ for larch@yhetil.org; Thu, 28 Apr 2022 09:45:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nk4SD-0007lx-JJ for emacs-orgmode@gnu.org; Thu, 28 Apr 2022 09:45:09 -0400 Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]:33764) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nk4SB-0003bl-Gm for emacs-orgmode@gnu.org; Thu, 28 Apr 2022 09:45:09 -0400 Received: by mail-qv1-xf29.google.com with SMTP id js10so3243792qvb.0 for ; Thu, 28 Apr 2022 06:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=R0KjyOWAN0yUjfW0tvwLzD8Y4ZWLNHyp+k4mPqHhWbQ=; b=Huz96F1Ygtn+2t1GXNMsSQFS/Kclgq6PMXGvDq5vU393JQDEjk2J9jtuZNu+JL5Hej svVLwPNcAXxSunTPECrD5AyxgsrNVMBk30/9mb2QKoRkaDk78m2Maj7bRCW0/oeqmR3V WyYQTQIO1JYe8HExikBaKeLZpJUKr/be0ACTlKeKtP++XLZy0lIq20A5Nb2mgeDYPRol CwSVmkqNb8N7NuiyR5epHVVNlqMwdoDdhLZqUrVCGhyvlmfdVrraEH+LolKR0BtvntWX F8QXH6OKwcjumU08w2BRsDQIGlg6NXWO0JO/GC5STZQIyUz0qDAUjBVu9DKf+/FRXX7g dWFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=R0KjyOWAN0yUjfW0tvwLzD8Y4ZWLNHyp+k4mPqHhWbQ=; b=pIfKzWKZGWEfx5z9yQm3o7AtCaftJZXryheEmfk0dYKUGxXMe1S+Snfal8Ccy2fqUu wMaHJOqiZ40uKikt25dYRiSmfcAFEmIacGXCsJzQroPG3oPvzCbPCu5+mLS4R9Eys3o4 T75FyP+mwxDT3dGEByi+7zQ2UqNX3OylYQOwBI0paqXTXW8b/bbQynAeAv3Fs8ZPk6ss a1mqvCVTuOI76H4aAnTr/Z0rgGWM31atrjaD0yhUvODaEDskW9C6GNImTYIvjnIuJrmO NXGGfYhOBy3VQ6Y+Bz50i+nYE8DG19ZFmu4A3RLuvE3IgsdOyQFfsve5h7JX+ePWFS1V 1nLQ== X-Gm-Message-State: AOAM533q/ctVYRg6uORMNtGOMxhzxot9p/MIBsaOigZYE1ox1oILidcG VeZVo/UeSG3ysLa6HvJh3nQ= X-Google-Smtp-Source: ABdhPJwyuWwkFkepMU4XoJhj1/Hxq4Gn51FBAW3lR++vCIdfOAyOT1U8Uw6VBqHk39BesOPtqAg9+w== X-Received: by 2002:a05:6214:b8e:b0:456:3674:ca6 with SMTP id fe14-20020a0562140b8e00b0045636740ca6mr15453045qvb.40.1651153506451; Thu, 28 Apr 2022 06:45:06 -0700 (PDT) Received: from localhost ([66.150.196.58]) by smtp.gmail.com with ESMTPSA id l19-20020a37f513000000b0069c5807ff10sm9343695qkk.27.2022.04.28.06.45.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 06:45:05 -0700 (PDT) From: Ihor Radchenko To: sebastien.miquel@posteo.eu Subject: Re: [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments In-Reply-To: <2dd9630a-c584-0702-62aa-393ad56c621e@posteo.eu> References: <2dd9630a-c584-0702-62aa-393ad56c621e@posteo.eu> Date: Thu, 28 Apr 2022 21:45:55 +0800 Message-ID: <875ymt8goc.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::f29; envelope-from=yantar92@gmail.com; helo=mail-qv1-xf29.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Help: List-Subscribe: , Cc: emacs-orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651153577; 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=R0KjyOWAN0yUjfW0tvwLzD8Y4ZWLNHyp+k4mPqHhWbQ=; b=QAxNixo6to1K3dXjtWr61aanapELjqWnLXoroXYEqVi2xIyNEZ72Mj/WnEzLsKXTqaZePI 5rNcwvctf/ds+BhZBSWQg8TiyKRl9wzHS0iWX/elNx09qlAKLhurU1zBD547uI59w/UGbF hEVr2oTEX5bXcMb53wgXPRPy99UG1uXmFjQPw6btOpK5p5X/L3VgivHUBVBd7eztZzzX61 1bLO2u4wadZ99qr3uzPBRgW+4dqdo2gsjfvvaVZnR5+e+spNh8BL8O8jO63vR02vWfV9UZ Ty8KdWQMRq4L0x/3tKq9BCZPReNB5+GJyt7m+gm4tYMWF0KFl0elbWwU+TumoQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651153577; a=rsa-sha256; cv=none; b=ENpDo0jYGDmERYSIrukG/CJWEm8/LEmvsBGD61BQG5DhJj3YNwHbW6cQjHXvzjP509QSnb X1g30n8IugFG1HPgEqX6tE3dMjTpqRCCIuVNHHyvvr6ZgzlgWLI4erSXyOcb6JQjH/D1Ht dmHMFs3ExOCgMXgS7uCWzPjm8x3Ij4CzNEgHpku4iN4+kfZloAGZ8jbVu6aZR4Lgf1l1pU A8sJuHOuMWCgCYKGT4F3vFInuBcehqWWgW0CV/yvuE5xY1fX3xXZxjoDdapxXAA4X4ZZJJ VjcSAsn2C58nMMpqjEbor2KulpYDo5VskmGm4gftBQIEqyx+1kASe6Ro0jxP0g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Huz96F1Y; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Spam-Score: -3.50 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Huz96F1Y; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Queue-Id: C5037275C0 X-Spam-Score: -3.50 X-Migadu-Scanner: scn1.migadu.com X-TUID: mbakyBNfIBbM S=C3=A9bastien Miquel writes: > The attached patch adds support for two new babel header arguments: > =3D:noweb-prefix=3D and =3D:noweb-trans=3D. > > =3D:noweb-prefix=3D can be set to =3Dno=3D to disable the noweb prefix > behaviour, where prefix characters are repeated when expanding a > multiline noweb reference. Thanks for the patch! The idea about :noweb-prefix looks useful. > =3D:noweb-trans=3D can be set to =3Dprin1-to-string=3D to insert a lisp s= tring > representing the content of the referenced src block. > > The goal is to allow one to use, say, a LaTeX src block to represent > some LaTeX snippet to be tangled into a string in some lisp (or other) > code. This isn't possible currently, and one has to manually string > escape the LaTeX code. > ... > I've left undocumented the possibility of setting =3D:noweb-trans=3D to > another function. I wonder if anyone can think of some other use. prin1-to-string is too specific and only solves a single use-case. Consider the following example: #+BEGIN_SRC emacs-lisp :noweb yes :tangle yes :noweb-prefix no :noweb-trans= prin1-to-string <> (setq latex-header <>) #+END_SRC There are two noweb references here. Setting source block-wide :noweb-trans is not helpful because the first reference will be incorrectly filtered through prin1-to-string. I'd rather introduce a new syntax to transform the noweb reference inline. Something like #+BEGIN_SRC emacs-lisp :noweb yes :tangle yes :noweb-prefix no <> (setq latex-header <<(prin1-to-string nw)>>) #+END_SRC > Noweb insertions honor prefix characters that appear before the noweb > -syntax reference. This behavior is illustrated in the following > -example. Because the =3D<>=3D noweb reference appears behind t= he > -SQL comment syntax, each line of the expanded noweb reference is > -commented. With: > +syntax reference. This behavior can be turned off by setting the > +=3Dnoweb-prefix=3D header argument to =3Dno=3D and is illustrated in the > +following example. Because the =3D<>=3D noweb reference appears > +behind the SQL comment syntax, each line of the expanded noweb > +reference is commented. With: This sounds a bit confusing. I would also add an example where it is useful to set :noweb-prefix to no. =20=20 Best, Ihor