[Top][All Lists]

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

Re: [O] [babel] How to set multiple variables with properties

From: Christian Moe
Subject: Re: [O] [babel] How to set multiple variables with properties
Date: Wed, 22 Jun 2011 20:27:00 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20110414 Thunderbird/3.1.10

Hi again,

I was referring to these functions:
- org-entry-put-multivalued-property
- org-entry-get-multivalued-property
- org-entry-add-to-multivalued-property
- org-entry-remove-from-multivalued-property
- org-entry-member-in-multivalued-property
described here:

I've found a few discussions:
- http://comments.gmane.org/gmane.emacs.orgmode/33457
- http://lists.gnu.org/archive/html/emacs-orgmode/2010-02/msg00251.html

I don't have anything working with them, as such,[1] and I was curious if anyone did. They don't currently seem to be integrated into completion, search functions, Babel, and so on, which would limit their usefulness (though searching can be done with regexps). And I think implementing wider support for them would run into a problem with distinguishing between properties that are meant to be multivalued, or and properties that just contain a single value which happens to contain spaces.

But handling multiple var=value expressions in a :var: property for Babel, as Darlan asked about, might perhaps be doable...? Stuff might break, though.


[1] I do have a small research database with some "multivalued" properties in it. For queries, I use your org-collector and regular expression matching against properties with multiple values. The multivalued-properties functions didn't really come into it, except that knowing they were there made me go ahead and put multiple values in one property. (As it turned out, that wasn't a very good design choice.)

On 6/21/11 11:03 PM, Eric Schulte wrote:
Hi Christian,

That's the first I've heard of that variable?  If you do get something
working with multivalued properties please do share.

Cheers -- Eric

Christian Moe<address@hidden>  writes:

Hi, Eric,

Just curious: What about the org-entry--multivalued-property functions
mentioned in "Using the properties API"?

Is anybody using multivalued properties for anything?


On 6/21/11 10:17 PM, Eric Schulte wrote:
Unfortunately org-mode properties only allow a single entry for any
given key, so you can only specify one variable using properties.

However the following workaround does exist.

*** alternative
      :var:      vars=variables

#+tblname: variables
| var1 | 1 |
| var2 | 2 |

#+begin_src python
    print vars[0][1]
    print vars[1][1]

Best -- Eric

Darlan Cavalcante Moreira<address@hidden>   writes:

I'm using org-babel to automate a few tasks and I'd like to define a few
variables that are common to several code blocks as sub-tree properties.

It works when I have only one variable, where I can use
* Heading
    :var: variable1="value1"
    #+begin_src python :results output
      print variable1

    : value1

Is it possible to set multiples variables in this way?
I tried things like
:var: variable1="value1" variable2="value2"

:var: variable1="value1",variable2="value2"

:variable1: "value1"
:variable2: "value2"
but none of them worked.

Darlan Cavalcante

reply via email to

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