[Top][All Lists]

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

Re: [O] two sets of default header arguments for one language

From: Rainer M Krug
Subject: Re: [O] two sets of default header arguments for one language
Date: Fri, 18 Sep 2015 12:17:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin)

Nicolas Goaziou <address@hidden> writes:

> Rainer M Krug <address@hidden> writes:
>> That's a pity.
>> It would be really great if one could define different sets of
>> hearer-args and then, at thr beginning of a code block, simply use:
>> #+MACRO: forTangle  :tangle ./test.R :export none
>> #+MACRO: forExecution  :tangle no :export both :session Test14
>> #+MACRO: forNoSession  :tangle no :export both
> It might be great. Probably hackish too.
> Anyway simplicity of macros is one of its features, IMO. They are
> limited, yet useful for simple things.
> Fortunately, there are other ways to achieve what you want without them.
>> Would it be difficult to include this feature?
> Probably not. The most permissive model for macros is even simpler to
> implement than the current one, i.e., something like
>   (replace-regexp-in-string macro-regexp macro-template buffer)
> However macros actually follow a different paradigm, in which they are
> required to be parsed. As a consequence they cannot really break the
> structure of their container, which turns them into "safe" tools. For
> example, you can compare the model above and the current one in the
> following document
>   A paragraph Paragraph{{{this(arg
>   #+name: table
>   | cell | )}}}  |
> Your proposal in to allow them where the parser doesn't look, e.g.,
> Babel header arguments, but probably also other places (node properties,
> keywords...). It is difficult to draw a line. In any case, I'm not sure
> macros would benefit from it. Babel can already do a lot of
> destructuring in a document, not every tool needs to be as versatile as
> Babel.

Thanks for your explanations - I am not using macros regularly (not
yet...) so I was not aware of these aspects.

I was just using macros as an example - I am not advocating to change
macros if this would change something. A simpler option would be
possibly to use properties. Assuming I have the following properties defined:

| #+PROPERTY: headerArgsForTangline :tangle ./testfile.R
| #+PROPERTY: headerArgsForSession :tangle no :session *MyRSession*
| #+PROPERTY: headerArgsForNoSession :tangle no

then I could do

| :header-args*: headerArgsForSession 

and the header arguments would be set to the value of
headerArgsForSession and be ":tangle no :session *MyRSession*".

This would make it possible to define sets of header arguments for
certain aspects (one example I would use it for: creating graphs and
define the width and height properties. Depending if I want portrait or
landscape graphs, I would use the one or the other property and they
could be ca=hanged easily for the whole document.)




Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      address@hidden

Skype:      RMkrug

PGP: 0x0F52F982

Attachment: signature.asc
Description: PGP signature

reply via email to

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