emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: :tangle header argument not picked up in #+PROPERTY line or :PROPERT


From: Berry, Charles
Subject: Re: :tangle header argument not picked up in #+PROPERTY line or :PROPERTIES: block
Date: Sun, 29 Mar 2020 20:41:21 +0000


> On Mar 29, 2020, at 1:13 PM, Joost Kremers <address@hidden> wrote:
> 
> 
> On Sun, Mar 29 2020, Berry, Charles via General discussions about Org-mode. 
> wrote:
>>> On Mar 28, 2020, at 3:00 PM, Joost Kremers <address@hidden> wrote:
>>> Is this expected behaviour? Am I doing something wrong?
>> 
>> IIUC what you did, then yes and yes.
>> 
>> This is the accepted idiom:
>> 
>> #+PROPERTY: header-args :tangle yes
> 


What we really need is an ECM rather than snippets of code.

This ECM works for me:

#+begin_src org

  ,* try python
  :PROPERTIES:
  :header-args:python: :tangle yes
  :END:
  ,#+begin_src python
  "a+b"
  ,#+end_src


#+end_src

producing a file of the same name with the .py extension with one line 
containing "a+b".

I am on release Org mode version 9.3.6 (release_9.3.6-442-g97f0f1 ), but this 
also work on release_9.3-34-g2eee3c

HTH,

Chuck

p.s. `M-x org-lint' may reveal some issues with your file that might not be 
obvious to the eye.

> I have tried:
> 
> #+begin_example
> #+PROPERTY: header-args:python :tangle yes :dir  /home/joost/tmp/dlpy
> #+end_example
> 
> which AFAICT is the syntax shown in the info node you mentioned. I have also 
> tried a file name instead of =yes=, both with and without quotes, but it 
> doesn't work.
> 
> What I really want is to have a property block with the =:tangle= arg under 
> each top-level header, like so:
> 
> #+begin_example
> :PROPERTIES:
> :header-args:python: :tangle out1.py
> :END:
> #+begin_example
> 
> because I want the code below each top-level header to be tangled to a 
> separate file. Again, AFAICT this is the syntax described in the info manual.
> 
> Hmm, experimenting a bit more I find that if I leave out the =python= part, 
> it works:
> 
> #+begin_example
> :PROPERTIES:
> :header-args: :tangle out1.py
> :END:
> #+begin_example
> 
> But the info manual gives this example:
> 
> #+begin_example
> :PROPERTIES:
> :header-args:clojure:    :session *clojure-1*
> :END:
> #+begin_example
> 
> The same is true for the #+PROPERTY block at the top of the file: leave out 
> the =python=, it works. Isn't it possible to restrict tangling to source 
> blocks of a particular language? (Or, more specifically what I want: to 
> specify different tangling targets for different language? I wanted to have 
> both python and bash code blocks under one header and have them tangled to 
> different files...)
> 
> Joost
> 
> 
> -- 
> Joost Kremers
> Life has its moments





reply via email to

[Prev in Thread] Current Thread [Next in Thread]