emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] [BABEL] "unset" :var definitions for subtree


From: Eric Schulte
Subject: Re: [Orgmode] [BABEL] "unset" :var definitions for subtree
Date: Wed, 09 Feb 2011 18:27:38 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Rainer M Krug <address@hidden> writes:

> Hi
>
> For one project, I am usinr org to write submit scripte to a cluster
> runing torqu. The important bit in this is, that between the shebang and
> the code, no other executable line must occur. As I am using variables
> in org (:var) they will occur just after the shebang, which causes a
> problem for torque. So, my question is, is there a way to "unset"
> variables defined by using :var for a subtree?
>

Hi Rainer,

Interesting question... unfortunately I don't think that removing
variables from header arguments is possible under the current setup.

Perhaps in your case you could add a function to the post-tangle hook,
which recognizes when it is being called in a just-tangled torqu script
(maybe by searching for a series of #PBS lines), and then removes any
lines between the shebang and the first #PBS line?

More generally, I wonder what a natural method would be to allow
unsetting of pre-set header arguments for local blocks or subtrees?
This may only apply to the :var header argument, as most others have a
default setting which can be actively set.  If you have any ideas for a
natural syntax for such an operation I'd be happy to hear it.

Cheers -- Eric

>
> #+BABEL: :session *R* :results output :exports both :tangle
> Analysis_sensitivity.R :var RESULTSDIR="/media/Results/" :var
> ANALYSISDIR="~/Documents/Projects/analysis/"
>
>
> * submit script (SA.sub)
> :PROPERTIES:
> :tangle:   ./SA.sub
> :exports: code
> :END:
> #+begin_src sh
>   #PBS -j y
>   #PBS -M address@hidden
>   #PBS -V
>   #PBS -l nodes=1:mem=4gb
>   ##
>   cd $PBS_O_WORKDIR
> #+end_src
>
> I would need the tangled code to be :
>
> #!/bin/bash
> #PBS -j y
> #PBS -M address@hidden
> #PBS -V
> #PBS -l nodes=1:mem=4gb
> ##
> cd $PBS_O_WORKDIR
>
> But it is
>
> #!/bin/bash
> RESULTSDIR=/media/Results/
> ANALYSISDIR=~/Documents/Projects/analysis/
> #PBS -j y
> #PBS -M address@hidden
> #PBS -V
> #PBS -l nodes=1:mem=4gb
> ##
> cd $PBS_O_WORKDIR
>
>
> But RESULTSDIR and ANALYSISDIR is used in the remainder of the document
> (several other subtrees)
>
> Any help appreciated,
>
> Rainer



reply via email to

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