emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel, src blocks and asymptote
@ 2009-09-16 12:50 Nicolas Goaziou
  2009-09-16 16:12 ` Nicolas Goaziou
  2009-09-16 17:01 ` Eric Schulte
  0 siblings, 2 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2009-09-16 12:50 UTC (permalink / raw)
  To: Org-mode list

Hello,

Org-babel looks very interesting. I am pleased to see an asymptote
module included in it. While testing it, I think I found 2 problems :


To activate the asymptote module, you have to begin the source block,
for example, with
#+begin_src asymptote :file bezier.pdf

Unfortunately, the major mode used to edit asymptote code is named
asy-mode. This leads to the following error when you edit the block
with C-c ' : no such language mode: asymptote-mode.

Perhaps that module should be named org-babel-asy ?


The second problem, related to Org Src handling, is that the code is
put in a temporary buffer. I don't know about other languages, but,
in asy-mode, you can't compile code while in that kind of buffer.
This can be quite problematic in a language oriented towards
graphics, as you need to often make previews of your work.

In other words, is there an option to associate a temporary file to
the process (even in a per-language basis) instead of a buffer ? Or do I
have to mess with org-src-mode-hook to try to fix it ?


Regards,

--
Nicolas Goaziou

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

* Re: org-babel, src blocks and asymptote
  2009-09-16 12:50 org-babel, src blocks and asymptote Nicolas Goaziou
@ 2009-09-16 16:12 ` Nicolas Goaziou
  2009-09-16 19:42   ` Eric Schulte
  2009-09-16 17:01 ` Eric Schulte
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2009-09-16 16:12 UTC (permalink / raw)
  To: Org-mode list


Actually, about the first problem, I found about org-src-lang-modes
variable and that you can do

(add-to-list 'org-src-lang-modes '("asymptote" . asy))

But, shouldn't this be done upon loading org-babel-asymptote, like
org-babel-ocaml, which points automatically ocaml to tuareg-mode ?

About the second problem, I can always edit code in native mode (C-c ')
go back to org file, compile the block, and visit the link provided. But
it still looks to me a bit awkward and unnatural and I still got the
urge to press C-c C-c in native mode.

-- 
Nicolas Goaziou

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

* Re: org-babel, src blocks and asymptote
  2009-09-16 12:50 org-babel, src blocks and asymptote Nicolas Goaziou
  2009-09-16 16:12 ` Nicolas Goaziou
@ 2009-09-16 17:01 ` Eric Schulte
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2009-09-16 17:01 UTC (permalink / raw)
  To: Org-mode list

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Org-babel looks very interesting. I am pleased to see an asymptote
> module included in it. While testing it, I think I found 2 problems :
>
>
> To activate the asymptote module, you have to begin the source block,
> for example, with
> #+begin_src asymptote :file bezier.pdf
>
> Unfortunately, the major mode used to edit asymptote code is named
> asy-mode. This leads to the following error when you edit the block
> with C-c ' : no such language mode: asymptote-mode.
>
> Perhaps that module should be named org-babel-asy ?
>

Thanks for the catch, I'm now mentioning asy-mode in the requirements of
org-babel-asymptote.el, and asy-mode is now listed as the major-mode for
asymptote blocks in the `org-src-lang-modes' variable.  After grabbing
the latest Org-mode you should be able to edit asymptote source-code
blocks using C-c '

>
> The second problem, related to Org Src handling, is that the code is
> put in a temporary buffer. I don't know about other languages, but,
> in asy-mode, you can't compile code while in that kind of buffer.
> This can be quite problematic in a language oriented towards
> graphics, as you need to often make previews of your work.
>
> In other words, is there an option to associate a temporary file to
> the process (even in a per-language basis) instead of a buffer ? Or do I
> have to mess with org-src-mode-hook to try to fix it ?
>

I don't believe that anything like this currently exists, but I agree
that it would be generally useful.  In the current setup the best way to
preview your work would probably be to...
1) jump out of edit-src-mode C-c '
2) re-run the source-code block from the Org-mode buffer C-c C-c

Some better options which come to mind are...
- use either a header argument or a language specific setting to specify
  that Org-edit-src should associate the src buffer with a temporary file
- add a command to org-edit-src-mode which writes the buffer to a
  temporary file
- something else...

Dan has more experience than myself in dealing with Org-edit-src so he
may have better ideas.  I do think this is an issue that deserves
further thought/discussion.

Thanks -- Eric

>
>
> Regards,
>
> --
> Nicolas Goaziou
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: org-babel, src blocks and asymptote
  2009-09-16 16:12 ` Nicolas Goaziou
@ 2009-09-16 19:42   ` Eric Schulte
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2009-09-16 19:42 UTC (permalink / raw)
  To: Org-mode list

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Actually, about the first problem, I found about org-src-lang-modes
> variable and that you can do
>
> (add-to-list 'org-src-lang-modes '("asymptote" . asy))
>

this is now provided in the default value of org-src-lang-modes

>
> About the second problem, I can always edit code in native mode (C-c ')
> go back to org file, compile the block, and visit the link provided.

for what it's worth this can be done in three key-chords
1) C-c '     jump back to org buffer
2) C-c C-c   recompile with `org-babel-execute-src-block'
3) C-c C-o   open file with `org-babel-open-src-block-result'

> But it still looks to me a bit awkward and unnatural and I still got
> the urge to press C-c C-c in native mode.

yea, understood, it would be much more convenient to optionally
associate the org-src-buffer with a temporary file to provide support
for those major modes (like asy-mode) which require a file name.

Thanks -- Eric

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

end of thread, other threads:[~2009-09-16 19:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-16 12:50 org-babel, src blocks and asymptote Nicolas Goaziou
2009-09-16 16:12 ` Nicolas Goaziou
2009-09-16 19:42   ` Eric Schulte
2009-09-16 17:01 ` Eric Schulte

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).