From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id KLzVNt590mInXAEAbAwnHQ (envelope-from ) for ; Sat, 16 Jul 2022 10:59:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id YGTwNt590mLlRAEA9RJhRA (envelope-from ) for ; Sat, 16 Jul 2022 10:59:10 +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 9A3902FE0A for ; Sat, 16 Jul 2022 10:59:10 +0200 (CEST) Received: from localhost ([::1]:34776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oCddl-00037y-6R for larch@yhetil.org; Sat, 16 Jul 2022 04:59:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCdbE-0008Sy-Uo for emacs-orgmode@gnu.org; Sat, 16 Jul 2022 04:56:32 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:37711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oCdbD-0007ab-FG for emacs-orgmode@gnu.org; Sat, 16 Jul 2022 04:56:32 -0400 Received: by mail-pj1-x102d.google.com with SMTP id y14-20020a17090a644e00b001ef775f7118so13615689pjm.2 for ; Sat, 16 Jul 2022 01:56:30 -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=XUnl1C1yVGCST65mA6HYjpNtctcrzid1FNnf5HoVHxk=; b=VlUDViRcOG3Ud2aGlz0MRMfTFaJ8ELhJrdjn9eq8cuMwde4Jc+qu7SG90inyoRCEAh BYY+aKCh5OnxKzJkyNTMU4UylO2bbs8qXTmQTZ39hEBb2zPbEQpfkeh6seix0ztq2H2R iFsqZAMWXagxLonOgPL0Bj9eTWxmXxMCUHf7WSsTdOzZDavZALGvHTQ9a8SukoRWt/nF CQhA1LWc3WzTc92rtut7isxQhi3rXqlbPfGUaESRqT6MlD4JS3Mc8FQQviMUU14XBp+d JN4WfwNmzlZvaPqJmgAw2xeH38OqeuAAJFVn1nIHEeImABS5V1zOm1w4kfYsTgub3ky4 JsTA== 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=XUnl1C1yVGCST65mA6HYjpNtctcrzid1FNnf5HoVHxk=; b=DtHTZ6tignCN0D2xG6oTrUBeDHz+wPwZ5bITG8I5OnRpbzrwgl4h+2iinUXzaR5zia Q077W289oxx1yohjPE+FILfVlAvXfg7XP6ILUovA5eG41SUrhjWu9888wx7+9xycLjKJ 1NDFr1ugFnHOs7RtcJ8tWKMiC1xdZdqrJF5ytfqHSbTL9HOP+Vr++dgi0wBpMSc6KgHN Wh0iWu00p1Of0FRVOJYlDP6dn6SF9ejv13pwy5NvbJS7bQvws9pDCZbbgVbtTgLD4GX5 xoUmgPEgSHTnEk53gnbjT1wiBRaZ7yxM9CUDyYjZweLbicDkfh2YqR6SOVhpHIeZQoje k2Yw== X-Gm-Message-State: AJIora/3m5GSdzN3qhmKrA9jXxcS1O7OJOVljkSEcvX9jiPf2NY4GKjI Pbc7ojCxpYnx9zy9hFffU3Q= X-Google-Smtp-Source: AGRyM1tdiVB8eoCtBP+5yrCkB1si8YvVy4jfg4h+sqep6dHAsyaP/W1r8F0YpgGcfBgHt9G48XMlDw== X-Received: by 2002:a17:902:b402:b0:16c:3cab:5910 with SMTP id x2-20020a170902b40200b0016c3cab5910mr17891234plr.96.1657961789488; Sat, 16 Jul 2022 01:56:29 -0700 (PDT) Received: from localhost ([2409:8a70:2bd:4d0:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id g9-20020a17090a300900b001ef83bcc262sm5051926pjb.43.2022.07.16.01.56.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 01:56:28 -0700 (PDT) From: Ihor Radchenko To: sebastien.miquel@posteo.eu Cc: emacs-orgmode Subject: [FR] Make :var foo=name-of-src-block assign the source block code instead of currently assigned result of evaluation (was: [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments) In-Reply-To: <7702b511-c289-5688-c64c-fb673324a63a@posteo.eu> References: <2dd9630a-c584-0702-62aa-393ad56c621e@posteo.eu> <875ymt8goc.fsf@localhost> <87v8urt8bu.fsf@localhost> <03eb4c66-ecaf-b5f5-c4cc-2195fb6c1a1a@posteo.eu> <87y1yiz3js.fsf@localhost> <7702b511-c289-5688-c64c-fb673324a63a@posteo.eu> Date: Sat, 16 Jul 2022 16:57:32 +0800 Message-ID: <87ilnxe8oz.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::102d; envelope-from=yantar92@gmail.com; helo=mail-pj1-x102d.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: , 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=1657961950; 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=XUnl1C1yVGCST65mA6HYjpNtctcrzid1FNnf5HoVHxk=; b=c3my0jHX007FBbCJklGxtE3FwJSOKzEDrtv8IANYHUJYl7U0sj+vGkn3QrcZi1XYw5RmCB oAHKNjGZZPil6joUX5SJWHdy+JmJqUoiz8vRIKSGInlgF3VMz0kdJfswlLvUhHEgAOLy5W sV6qm/4/HuRHbNuSGChXFFT2Dkz5l3pBoxt3B1GYMMQyPKDq+2G+8TjcRQp6IzGKZr6oaV MxEFT7ztf2SMgv37UGEL1m+uUU0PS6q8OfVJOdW1QqipMwycDDjbjvLdC6YtmTBgFtsooE T0DvosZUiF3O6Zv7Z/Xx9U3e2DSpyJj7Igqf1DHptGot7F42hDmkuNavYkYU/w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657961950; a=rsa-sha256; cv=none; b=r8/BAsClb5gETIZ10/0RUmOKKJR2pXUjsKJHUK9SYSBlIbgp6k3yy/94E64bf9VhMOyINj IndqyUI/YAYER13sVFY6U2Hv+LS/1ueBaYx1Gj7kC8uxXLfbRCaBHbaSdV2R5JfngnMNck gMMgft1qRfhowwSzT9kit/ZzXmXeYfZe1Mx5KFNPxFPSvx9VhVEqE/4XL/taNziiSmUvg0 oei3eI0a/PH1xlTyh9HH9yXh9WyD8L/PUvE2bUHO0mbB1YAoOEvyWSx48OZ4jdxYxOhkoi 0PfeCfNy+xY+HDjAGC7puePXvSY+GTMjFAGtbudFmh1FKcjULqxEIkXjBE/bCw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VlUDViRc; 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.44 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VlUDViRc; 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: 9A3902FE0A X-Spam-Score: -3.44 X-Migadu-Scanner: scn1.migadu.com X-TUID: LUfYk+MJyzY0 S=C3=A9bastien Miquel writes: > Ihor Radchenko writes: >> Can you provide more concrete examples? >> >>> Some drawbacks: >>> =C2=A0+ doesn't work for all languages (does work for LaTeX) >> Which languages do not work? > Most languages do not work. Using your proposed solution, what I'm > trying to do is > > #+name:javascript-header > #+begin_src javascript :tangle no > some javascript, with \ and " to be escaped > #+end_src > > #+name: string-escape > #+begin_src emacs-lisp :var str=3D"" :tangle no > (prin1-to-string (string-trim-right str)) > #+end_src > > #+begin_src emacs-lisp :noweb yes :tangle yes > (setq javascript-header <>) > #+end_src > > If you replace javascript with latex, it happens to work, because when > org executes a latex block, it prints its content. > > The goal is to tangle to some lisp code whose purpose is to generate > LaTeX/javascript code. Quite niche admittedly, though as you showed, > it could also be used to string-escape documentation. Thanks for providing an example! The current behaviour of :var foo=3Dname-of-src-block is assigning result of evaluation. However, this behaviour is actually not documented. 16.4 Environment of a Code Block section of the manual only documents uses like #+BEGIN_SRC emacs-lisp :var length=3Dtable-length() or #+BEGIN_SRC emacs-lisp :var input=3Ddouble(input=3D1) Currently, #+BEGIN_SRC emacs-lisp :var length=3Dtable-length is the same with #+BEGIN_SRC emacs-lisp :var length=3Dtable-length() Given that #+BEGIN_SRC emacs-lisp :var x=3Dliteral-example inserts the literal contents of the example block, I am voting to change the current undocumented behaviour for assigning the code block references. This will make the discussed example work while not restricting the existing features. WDYT? Best, Ihor