emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Babel support for Processing-language
@ 2014-09-15 17:09 Jarmo Hurri
  2014-09-15 19:05 ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Jarmo Hurri @ 2014-09-15 17:09 UTC (permalink / raw)
  To: emacs-orgmode


Greetings fellow org-fans!

I have already designed a couple of programming courses, and am now
considering getting involved in a new one. This one will be aimed at
young novices. I have decided that I only want to do this if the
programming language used is very visual.

The two options I have considered are Processing and Asymptote. Both
have their pros and cons, but Processing has the great advantage of more
or less direct support for animations. Animations can be done with
Asymptote, but it is pretty cumbersome, and you can not see the results
immediately. Animations would be a great way to lure youngsters into
programming. I run one Java course where the kids go nuts when they can
get something moving on the screen; for that course I have written an
underlying "game engine" myself.

Another condition I have set for the project is the ability to write the
material using org-mode. If I can not interleave writing, code and
results babel-style then I am just not interested. I have written one R
course using makefiles, and it's just a pain to do for anyone who has
seen what org is capable of.

So, finally, to the point. I would very much like to see support for the
Processing-language in org-mode. Supporting editing the language seems
straightforward, since there already is an Emacs-mode for Processing 2:

https://github.com/ptrv/processing2-emacs

I just installed Processing 2 and the Emacs mode in Fedora 20 and they
work together like a charm.

However, I have _no idea_ what kind of work supporting output capture of
both static mode (image) and active mode (animation) would
require. Ideally, Babel support for Processing output would mean that in
the case of
1. an animation 
   - HTML export it would export the entire animation
   - PDF export it would export, e.g., the first frame from the
     animation
2. a static picture, the picture would be exported.

I think I might be asking for a lot. I am willing to work on this, but I
don't know what kind of an approach I should take. The command-line
support for Processing 2 (the program 'processing-java') runs the output
in a separate window. Would I have to capture the output of the window
with something like ffmpeg? Sounds like a huge hassle.

My questions would be:
I. Is anybody currently working on Processing 2 support in Babel?
II. Anybody interested?
III. Any other ideas? On this topic? ;-)

All the best,

Jarmo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Babel support for Processing-language
  2014-09-15 17:09 Babel support for Processing-language Jarmo Hurri
@ 2014-09-15 19:05 ` Nick Dokos
  2014-09-16 10:19   ` Jarmo Hurri
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2014-09-15 19:05 UTC (permalink / raw)
  To: emacs-orgmode

Jarmo Hurri <jarmo.hurri@syk.fi> writes:

> ...
> I just installed Processing 2 and the Emacs mode in Fedora 20 and they
> work together like a charm.
>
> However, I have _no idea_ what kind of work supporting output capture of
> both static mode (image) and active mode (animation) would
> require. Ideally, Babel support for Processing output would mean that in
> the case of
> 1. an animation 
>    - HTML export it would export the entire animation
>    - PDF export it would export, e.g., the first frame from the
>      animation
> 2. a static picture, the picture would be exported.
>
> I think I might be asking for a lot. I am willing to work on this, but I
> don't know what kind of an approach I should take. The command-line
> support for Processing 2 (the program 'processing-java') runs the output
> in a separate window. Would I have to capture the output of the window
> with something like ffmpeg? Sounds like a huge hassle.
>

Here's a possible starting point in your research:

  http://orgmode.org/worg/org-contrib/babel/languages.html#develop

My next step would be to find an ob-<lang>.el that is as similar
as possible to what Processing does and what I'd want to achieve
and go from there. The link above mentions ob-template.el which
might be a good beginning too.

It's probably best to leave animations for last, but if the animation
can be stored in a file, then having a link that will play the file
seems like an easy thing to do.

All this is untainted by any knowledge of Processing, let alone any kind
of hands-on testing or actual practice, so treat it with the appropriate
size grain (boulder?) of salt.

Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Babel support for Processing-language
  2014-09-15 19:05 ` Nick Dokos
@ 2014-09-16 10:19   ` Jarmo Hurri
  2015-02-02 11:07     ` Jarmo Hurri
  0 siblings, 1 reply; 4+ messages in thread
From: Jarmo Hurri @ 2014-09-16 10:19 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Jarmo Hurri <jarmo.hurri@syk.fi> writes:
>
>> ...
>> However, I have _no idea_ what kind of work supporting output capture of
>> both static mode (image) and active mode (animation) would
>> require. Ideally, Babel support for Processing output would mean that in
>> the case of
>> 1. an animation 
>>    - HTML export it would export the entire animation
>>    - PDF export it would export, e.g., the first frame from the
>>      animation
>> 2. a static picture, the picture would be exported.
>
> Here's a possible starting point in your research:
>
>   http://orgmode.org/worg/org-contrib/babel/languages.html#develop
>
> My next step would be to find an ob-<lang>.el that is as similar
> as possible to what Processing does and what I'd want to achieve
> and go from there.

Yep, I am going to start doing this if no-one is working on it yet.

I woke up in the middle of the night to realize how amazingly easily
this can be done if I drop out the support for PDF export, that is, only
leave the option to export as HTML. There is no need to even execute the
code at export time to draw the image or the animation, because in HTML
you can just wrap the original Processing code in a canvas element and
the Processing.js code will draw it in the browser.

http://en.wikipedia.org/wiki/Processing.js

Let me repeat: by just exporting the code suitably embedded in the HTML
document, the _browser_ will draw the image or the animation. I just
tested it and it works perfectly.

So I will implement this in Org/Babel so that
- executing Processing code will result in the image / animation being
  shown in an external window via processing-java
- exporting the results of Processing code is only sensible in HTML
  export, which will produce a web page with the code embedded as
  described above; the browser does the drawing.

These operations will require the availability of processing-java and
processing.js in the system where the code is executed/exported.
  
Any objections?

Jarmo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Babel support for Processing-language
  2014-09-16 10:19   ` Jarmo Hurri
@ 2015-02-02 11:07     ` Jarmo Hurri
  0 siblings, 0 replies; 4+ messages in thread
From: Jarmo Hurri @ 2015-02-02 11:07 UTC (permalink / raw)
  To: emacs-orgmode


Jarmo Hurri <jarmo.hurri@syk.fi> writes:

> Yep, I am going to start doing this if no-one is working on it yet.
>
> I woke up in the middle of the night to realize how amazingly easily
> this can be done if I drop out the support for PDF export, that is,
> only leave the option to export as HTML. There is no need to even
> execute the code at export time to draw the image or the animation,
> because in HTML you can just wrap the original Processing code in a
> canvas element and the Processing.js code will draw it in the browser.
>
> http://en.wikipedia.org/wiki/Processing.js
>
> Let me repeat: by just exporting the code suitably embedded in the HTML
> document, the _browser_ will draw the image or the animation. I just
> tested it and it works perfectly.
>
> So I will implement this in Org/Babel so that
> - executing Processing code will result in the image / animation being
>   shown in an external window via processing-java
> - exporting the results of Processing code is only sensible in HTML
>   export, which will produce a web page with the code embedded as
>   described above; the browser does the drawing.
>
> These operations will require the availability of processing-java and
> processing.js in the system where the code is executed/exported.

I posted the quoted message a while back, indicating that I would start
working on Processing support in org mode. I now have the time to start
implementing it. I will take one of the other language support files as
a basis.

If anybody has anything they'd like to add to my idea at this time, feel
free to do so. I will be working on this on and off, but this should be
done by the end of the spring. I will need Processing support in the
autumn in a project.

All the best,

Jarmo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-02 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15 17:09 Babel support for Processing-language Jarmo Hurri
2014-09-15 19:05 ` Nick Dokos
2014-09-16 10:19   ` Jarmo Hurri
2015-02-02 11:07     ` Jarmo Hurri

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).