From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 4N16DYyfu1+4UQAA0tVLHw (envelope-from ) for ; Mon, 23 Nov 2020 11:39:56 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id sHdRCYyfu1/uPwAAbx9fmQ (envelope-from ) for ; Mon, 23 Nov 2020 11:39:56 +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 87AB79404E7 for ; Mon, 23 Nov 2020 11:39:55 +0000 (UTC) Received: from localhost ([::1]:38284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khACH-0001z1-P9 for larch@yhetil.org; Mon, 23 Nov 2020 06:39:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khABq-0001xt-DR for emacs-orgmode@gnu.org; Mon, 23 Nov 2020 06:39:26 -0500 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:32827) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1khABo-0001G1-5D for emacs-orgmode@gnu.org; Mon, 23 Nov 2020 06:39:26 -0500 Received: by mail-lf1-x12e.google.com with SMTP id l11so23350861lfg.0 for ; Mon, 23 Nov 2020 03:39:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=therning-org.20150623.gappssmtp.com; s=20150623; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=Qk3KMM4RfqhAzzvu24JDXWs1XE0jVj1E9AfwfQNH9Xg=; b=CA3ufYBM21rPfEPhcdWl2+VuiNH5DtPjW4s9qIlyujwAOAAU0mQK/IRu9abE8rb8uq VMfc9Uc/88Pw8mIN2VHWZVcM09aUbF5X3h7s/yJE6SZX0G9ZUPn+MXJlWk8GeUQFCYsI x1gkTU4uqCj8tlXKoyEZAdedwXbBzewy6oNvNAQb+0PEJTB3dW2tfQCcFBH2FWNzDeuo BaGSGjMjYJlKGreTlkBO8aW2/i49um77dv5ihVjduhSmWKdJihfkhAjT1RpeB89K72Ar RGLG5EZ2WF78X1O0W6HN4qeHtoZkIozKu8KcURf9VrE6uEYx5EO2TE0JyyoOzSO082R+ ilmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=Qk3KMM4RfqhAzzvu24JDXWs1XE0jVj1E9AfwfQNH9Xg=; b=Ep4wFVemrKnrMUhbKYhAFelVBecDOIa8sPKGTaAuEuqtc3njG5sytvMJDlBmCvP/Uw j7Z0ceHJDQGvk9GmmYGLJmI+KMcDLrACFmIMUelk59ao2Pw1I/tjkqV5aK8mgh5dgcWt R6XpRGzA7IfD/dRMnpUfNM7oGUDSh/v3cLVMxz0pvQljwfDIqjPiQJfyMtm7ahbs6ou3 J7GaVEyw2NzD55ZCyfFPVFZBfiWpiU+nQqrkR3HnQnaHDG+yTwtR2cA0e1ck/CA6LpUw c08SZytopn1qB688VY7p23yV6SGZrglqj6JueuHtnFJoT8++pM8lwE+J6/J2U4oe1okW CIEg== X-Gm-Message-State: AOAM532XVz0l7JnTpt9cM7rTXIkwypKexHWt3kaGACm7LF5jhdNHmLAl ie5YM5p53pxuyov4eeytV8bJ0AIKYZPREOy5 X-Google-Smtp-Source: ABdhPJwo3Fm9NvvzU2ZfAnspHSee3Wr2iGgEatBWY6cyB0FiMqkB4/OWXoJpQQBAXX+lvCqiwJwpZg== X-Received: by 2002:ac2:5a49:: with SMTP id r9mr2564724lfn.381.1606131561272; Mon, 23 Nov 2020 03:39:21 -0800 (PST) Received: from magthecomp (c83-252-53-114.bredband.comhem.se. [83.252.53.114]) by smtp.gmail.com with ESMTPSA id q13sm1351598lfk.147.2020.11.23.03.39.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 03:39:20 -0800 (PST) References: <87d006z6kl.fsf@therning.org> <6DE39B70-57CF-48E7-BD22-39D7140A2EA2@health.ucsd.edu> User-agent: mu4e 1.4.13; emacs 27.1 From: Magnus Therning To: "Berry, Charles" Subject: Re: Using a code block as input to another code block In-reply-to: <6DE39B70-57CF-48E7-BD22-39D7140A2EA2@health.ucsd.edu> Message-ID: <873610480x.fsf@therning.org> Date: Mon, 23 Nov 2020 12:39:10 +0100 MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: none client-ip=2a00:1450:4864:20::12e; envelope-from=magnus@therning.org; helo=mail-lf1-x12e.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Emacs Org Mode mailing list Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=therning-org.20150623.gappssmtp.com header.s=20150623 header.b=CA3ufYBM; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -3.31 X-TUID: 7lzs6F5BqIJ1 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Berry, Charles writes: > Inline. > >> On Nov 21, 2020, at 2:30 PM, Magnus Therning wrote: >> >> I know I can use an example block (literal example) as input to a code >> block, but I haven't found a way to fontify examples. Since my input is >> code (JSON, and various programming languages) I would really like to >> have that, as well as the language's mode when editing by using >> ~org-edit-source-code~. >> >> A code block gives me fontification, but I haven't found a way to pass a >> code block as is to another code block. >> >> For instance, something like this: >> >> #+name: code-input >> #+begin_src C >> #include >> #+end_src >> >> #+begin_src bash :var input=3Dinput :results verbatim >> cat <> ${input} >> EOF >> #+end_src > > > Sounds like you want the :noweb header and code chunks, viz. > > #+begin_src bash :noweb yes :results verbatim > cat < <> > EOF > #+end_src > > HTH, > > Chuck > > [deleted] Ah, I didn't think of that. It does have some limitations though as :noweb isn't as flexible as shell expansion. For instance, I'm not able to do #+name: my-json #+begin_src json { ... } #+end_src #+begin_src bash :noweb yes :results verbatim cat <> | jq '@text') } EOF #+end_src Though it isn't too difficult to work around in this case: #+begin_src bash :noweb yes :results verbatim cat <> EOF0 { "foo": $(cat /dev/stdin) } EOF1 #+end_src It's absolutely a workable solution. Thanks! /M =2D- Magnus Therning OpenPGP: 0x927912051716CE39 email: magnus@therning.org twitter: magthe http://magnus.therning.org/ Sometimes I wonder whether the world is being run by smart people who are putting us on or by imbeciles who really mean it. =E2=80=94 Mark Twain Clearly, it's the imbeciles. And they really mean it. =E2=80=94 DBT --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEKwgezhW98spw4aSSknkSBRcWzjkFAl+7n14UHG1hZ251c0B0 aGVybmluZy5vcmcACgkQknkSBRcWzjnz9hAAmxM/am1hFr5JU06Pddqf+zEyd+n+ 6VSnpnuYStftdexq8BmKPkxL/HI/75gWX1v5NhTbBCrheTzP0dHvqveZTP2UKxZm j6X+CYT6XUPZPeNBgCljLybGjVG1WRlT6UVgWqkxllwiKUoxPA84DW2Ot4alAZjo c4pN9K+sZk2vflslyQwSYxRUp5UDIkLVhrbhEY1uCLQZjd8smQ9rcgCHWQWTKDHX 705jDqdvNOqKy5OiVIOquju2y1rAgZfiXohvqlDF7VWvV+Pw62HDgN47/pX+cchf ytX6pyKfr+VoNbow6Sz4VrZN2tpvQRT7k/TyJQRE8zTXltoYX0mMKE5GczHOxHfb oCrNdXkh2Uax/cWh8fVPECltiEmDKDfiLciIO4/Tua/S4VR+vnhH4ZurJtScOz+1 XgQbqYRYrhuoJMqxKOaCcdQub0Enq6zG2PGyrjumd181omYR6eAdIvVlwKkyrPnl 87nIvbZOWYlSyqyvW7w++IoP4rzH3yR7MBTqMWBQNQ61x0ZQ5AKTjlxy0+R29JXm ueA3KWy9bPr5jHmOpEvzQ+NDwye9p7vB+GPM3DKjXxLr4EkOSLvl/D3rp7JmOMLj NbAxZwsR/39+mobfDXhyveQdeaHg2kNse7wj9eSwHlSLhsCRNlqXlFNDBsMw6mZy 4X5N+NTS63MklNY= =AhPB -----END PGP SIGNATURE----- --=-=-=--