From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Miele Subject: Re: noweb and :var statements Date: Sun, 06 Oct 2019 21:08:35 +0000 Message-ID: <87ftk5inu4.fsf@gmail.com> References: <87k19hg7g1.fsf@gmail.com> <87k19hirz7.fsf@gmail.com> <87imp1irdr.fsf@gmail.com> <87ftk5fxi5.fsf@gmail.com> Reply-To: sebastian.miele@gmail.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:38714) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHDlf-0004Ga-L0 for emacs-orgmode@gnu.org; Sun, 06 Oct 2019 17:08:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHDle-00046m-K5 for emacs-orgmode@gnu.org; Sun, 06 Oct 2019 17:08:39 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:36599) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iHDle-000445-C0 for emacs-orgmode@gnu.org; Sun, 06 Oct 2019 17:08:38 -0400 Received: by mail-wr1-x435.google.com with SMTP id y19so12890539wrd.3 for ; Sun, 06 Oct 2019 14:08:38 -0700 (PDT) In-reply-to: <87ftk5fxi5.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Ken Mankoff Cc: emacs-orgmode@gnu.org Ken Mankoff writes: > On 2019-10-06 at 21:52 +02, Sebastian Miele wrote... >> I wrote: >> >>> [..] >>> >>> However, something like the following may suit your use case. (For the >>> header-args property see section 15.2 (Using Header Arguments) of the >>> manual.) >>> >>> * A Heading >>> :PROPERTIES: >>> :header-args: :var table=table_foo >>> :END: >>> >>> #+NAME: table_foo >>> | foo | >>> |-----| >>> | 42 | >>> | 100 | >>> >>> #+NAME: import >>> #+BEGIN_SRC python >>> import numpy as np >>> table = np.array(table).astype(np.float).flatten() >>> #+END_SRC >>> >>> #+BEGIN_SRC python :noweb yes :tangle import_noweb.py >>> <> >>> #+END_SRC >> >> Just the following works too, of course: >> >> #+NAME: table_foo >> | foo | >> |-----| >> | 42 | >> | 100 | >> >> #+NAME: import >> #+BEGIN_SRC python >> import numpy as np >> table = np.array(table).astype(np.float).flatten() >> #+END_SRC >> >> #+BEGIN_SRC python :noweb yes :var table=table_foo :tangle import_noweb.py >> <> >> #+END_SRC > > The result of tangling this is "import_noweb.py" contains: > > import numpy as np > table = np.array(table).astype(np.float).flatten() > > And I'd like it to somewhere include the line: > table = [42,100] > or something similar. I don't have the table data in the tangled code. Strange. On my system, typing C-c C-v t (org-babel-tangle) in an Org file with the above mentioned contents does yield a file import_noweb.py with the following contents: table=[[42], [100]] import numpy as np table = np.array(table).astype(np.float).flatten() Please try it with emacs -Q. Maybe your config is broken.