[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?
From: |
Eric Schulte |
Subject: |
Re: [O] How-to evaluate Java-snippets in org-mode/org-babel? |
Date: |
Wed, 06 Jul 2011 07:38:10 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Torsten Wagner <address@hidden> writes:
> Hi Eric,
>
> Somehow I was pretty sure you would answer ;)
>
> I tried your example and it work great so far.
>
> I have three points which I would like to discuss
>
> 1. I thought it might be nice to declare the package and class name
> for the java-stuff as variable in a property node then I could do
> something like:
>
> * Coursework 1
> :PROPERTIES:
> :var: PKGNAME="cw1"
> :var: CLASS="calc"
> :END:
>
> ** Snippet 1
> ** Snippet 2
>
> * Coursework 2
> :PROPERTIES:
> :var: PKGNAME="cw2"
> :var: CLASS="string"
> :END:
>
> ** Snippet 1
> ** Snippet 2
>
> Unfortunately, org-mode does not allow multiple definition of the same
> property. I know there is a work around with a table. However, I
> thought I could use simply a list.
>
> :var: vars="(cw1 calc)"
quotes force string interpretation, try something like the following...
#+begin_src emacs-lisp :var lst='(0 1 2)
(first lst)
#+end_src
#+results:
: 0
or as a noweb reference
#+data: external-list
- 0
- 1
- 2
#+begin_src sh :noweb yes
echo <<external-list()[0]>>
#+end_src
#+results:
: 0
>
> and use this in my shell script. However, this doesn't work. I can't
> index them. Any idea? Should it work in principle? Could I e.g., use
> :var: vars="{'x': 128, 'y': 210}" and put this in a python block
> accessing them by vars['x'] and vars['y']? That would be great!
>
The only data types which can be passed between Org-mode code blocks
currently are lists (of arbitrary dimension), numbers and strings.
Hashes (or "dictionaries") are not currently supported.
>
>
> 2. I'm not totally sure but it seems that tangling creates the desired
> file if it is not existing so fare but it does not create folders
> thus, :tangle path/filename seems not to work.
see the :mkdirp header argument http://orgmode.org/manual/mkdirp.html
>
> Any reason for this or maybe good idea to add it as a feature? For
> now, I added a little shell-based block "start" which takes care of
> this.
>
> 3. Tangleing and executing the code via a shell blocks works great. I
> saw somewhere that you could even tangle from the command line by
> calling emacs in batch mode. That's maybe a bit overcomplex for my
> task but some additional style to noweb might be nice. Instead of
> placing the code block at the point of call, tangle the code
> block. Then I could call
>
> <<start>>
> <<snippet>>
> <<execute>>
>
> If I understood right, noweb for now only place the code of the block
> at the particular place. Maybe, I could write a lisp-block "tangle"
> which tangles the code and call it via
> <<tangle(snippet)>>
> Just want to know if this might be a good idea in general or if this
> works already in some other way.
>
You probably don't want to pass the body of a code block to a lisp
function as quoting will become a nightmare, however passing the name to
a lisp block may be reasonable.
I would suggest that rather than implementing this behavior in a code
block you take a look at starting a ob-java.el file. A partial
implementation (e.g., only external evaluation, no session evaluation)
would be a useful contribution, and given the many helper functions and
examples present in the other ob-* files this would most likely be
easier than a custom lisp-block implementation.
Best -- Eric
>
> All the best
>
> Totti
>
--
Eric Schulte
http://cs.unm.edu/~eschulte/
- [O] How-to evaluate Java-snippets in org-mode/org-babel?, Torsten Wagner, 2011/07/05
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Eric S Fraga, 2011/07/05
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Eric S Fraga, 2011/07/05
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel ?, Jason F. McBrayer, 2011/07/05
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Torsten Wagner, 2011/07/06
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Eric Schulte, 2011/07/06
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel ?, Jason F. McBrayer, 2011/07/06
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Torsten Wagner, 2011/07/06
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Eric S Fraga, 2011/07/06
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Torsten Wagner, 2011/07/06
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?,
Eric Schulte <=
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Torsten Wagner, 2011/07/14
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Eric Schulte, 2011/07/15
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Torsten Wagner, 2011/07/17
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Eric Schulte, 2011/07/18
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Torsten Wagner, 2011/07/28
- Re: [O] How-to evaluate Java-snippets in org-mode/org-babel?, Eric Schulte, 2011/07/28