emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [org-babel] How to tangle "org-mode" files?
@ 2010-04-15  8:33 Daniel Brunner
  2010-04-15 17:10 ` Dan Davison
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Brunner @ 2010-04-15  8:33 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I am testing some ideas with org-babel (which is really great work) and
got the following problem: I want to put several org-mode source blocks
in one org-mode file and tangle them afterwards. Therefore I produced
the following a.org:

-->8--
#+begin_src org :tangle in-a.org
  ,* Foo
  ,** Bar
#+end_src
-->8--

Then I thought I have to add "org" to the list of known tangle
languages:

> (add-to-list 'org-babel-tangle-langs '("org" "org"))

And when I know try a org-babel-tangle for example with

> (org-babel-tangle-file "a.org") 

Nothing happens. 

Can anybody help with what I am doing wrong? 


Kind regards, Daniel

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

* Re: [org-babel] How to tangle "org-mode" files?
  2010-04-15  8:33 [org-babel] How to tangle "org-mode" files? Daniel Brunner
@ 2010-04-15 17:10 ` Dan Davison
  2010-04-16  7:12   ` Daniel Brunner
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Davison @ 2010-04-15 17:10 UTC (permalink / raw)
  To: Daniel Brunner; +Cc: emacs-orgmode

Daniel Brunner <daniel@dbrunner.de> writes:

> Hi,
>
> I am testing some ideas with org-babel (which is really great work) and
> got the following problem: I want to put several org-mode source blocks
> in one org-mode file and tangle them afterwards. Therefore I produced
> the following a.org:
>
> -->8--
> #+begin_src org :tangle in-a.org
>   ,* Foo
>   ,** Bar
> #+end_src
> -->8--
>
> Then I thought I have to add "org" to the list of known tangle
> languages:
>
>> (add-to-list 'org-babel-tangle-langs '("org" "org"))
>
> And when I know try a org-babel-tangle for example with
>
>> (org-babel-tangle-file "a.org") 
>
> Nothing happens. 
>
> Can anybody help with what I am doing wrong? 

Hi Daniel,

Short answer: please add

(org-babel-add-interpreter "org")

Long answer: I think there is room for improvement in org-babel
here. For example, the protective commas are not stripped out on
tangling, but I feel that they should be. And we need to clarify in the
documentation when org-babel-add-interpreter is needed and when adding
to org-babel-tangle-langs is required. I'm adding this to our todo list.

Best wishes,

Dan


>
>
> Kind regards, Daniel
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please 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: [org-babel] How to tangle "org-mode" files?
  2010-04-15 17:10 ` Dan Davison
@ 2010-04-16  7:12   ` Daniel Brunner
  2010-04-26 14:52     ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Brunner @ 2010-04-16  7:12 UTC (permalink / raw)
  To: emacs-orgmode

Hi Dan,

thanks for the advice. After the org-babel-add-interpreter I got another
error message that org-babel-execute:org is not defined. 

I then added (I took the code from org-babel-css.el) a 

(defun org-babel-execute:org (body params)
  "Execute a block of org code with org-babel. This function is calles by `org-babel-execute-src-block'."
  (message "executing ORG source code block")
  body)

and after that the tangle worked. But you're right: The remaining commas
are not that helpful and my opinion would be too to strip them out. If I
could help please let me know. 

Best wishes,


Daniel

Dan Davison <davison@stats.ox.ac.uk> writes:

> Daniel Brunner <daniel@dbrunner.de> writes:
>
>> Hi,
>>
>> I am testing some ideas with org-babel (which is really great work) and
>> got the following problem: I want to put several org-mode source blocks
>> in one org-mode file and tangle them afterwards. Therefore I produced
>> the following a.org:
>>
>> -->8--
>> #+begin_src org :tangle in-a.org
>>   ,* Foo
>>   ,** Bar
>> #+end_src
>> -->8--
>>
>> Then I thought I have to add "org" to the list of known tangle
>> languages:
>>
>>> (add-to-list 'org-babel-tangle-langs '("org" "org"))
>>
>> And when I know try a org-babel-tangle for example with
>>
>>> (org-babel-tangle-file "a.org") 
>>
>> Nothing happens. 
>>
>> Can anybody help with what I am doing wrong? 
>
> Hi Daniel,
>
> Short answer: please add
>
> (org-babel-add-interpreter "org")
>
> Long answer: I think there is room for improvement in org-babel
> here. For example, the protective commas are not stripped out on
> tangling, but I feel that they should be. And we need to clarify in the
> documentation when org-babel-add-interpreter is needed and when adding
> to org-babel-tangle-langs is required. I'm adding this to our todo list.
>
> Best wishes,
>
> Dan
>
>
>>
>>
>> Kind regards, Daniel
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please 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] How to tangle "org-mode" files?
  2010-04-16  7:12   ` Daniel Brunner
@ 2010-04-26 14:52     ` Eric Schulte
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2010-04-26 14:52 UTC (permalink / raw)
  To: Daniel Brunner; +Cc: emacs-orgmode

Hi Dan,

Daniel Brunner <daniel@dbrunner.de> writes:

> Hi Dan,
>
> thanks for the advice. After the org-babel-add-interpreter I got another
> error message that org-babel-execute:org is not defined. 
>
> I then added (I took the code from org-babel-css.el) a 
>
> (defun org-babel-execute:org (body params)
>   "Execute a block of org code with org-babel. This function is calles by `org-babel-execute-src-block'."
>   (message "executing ORG source code block")
>   body)
>

I'm now using the following to tangle org-mode blocks, this will strip
all leading commas, and shouldn't cause any problems.

--8<---------------cut here---------------start------------->8---
(add-to-list 'org-babel-tangle-langs '("org" "org" nil t))
(org-babel-add-interpreter "org")
(defun org-babel-expand-body:org (body params &optional processed-params)
  (with-temp-buffer
    (insert body)
    (goto-char (point-min))
    (while (re-search-forward "^," nil t)
      (replace-match ""))
    (buffer-string)))
--8<---------------cut here---------------end--------------->8---

>
> and after that the tangle worked. But you're right: The remaining commas
> are not that helpful and my opinion would be too to strip them out. If I
> could help please let me know. 
>

If the above proves insufficient in some way please let me know, and we
can try some more complicated solutions.

Thanks -- Eric

>
> Best wishes,
>
>
> Daniel
>
> Dan Davison <davison@stats.ox.ac.uk> writes:
>
>> Daniel Brunner <daniel@dbrunner.de> writes:
>>
>>> Hi,
>>>
>>> I am testing some ideas with org-babel (which is really great work) and
>>> got the following problem: I want to put several org-mode source blocks
>>> in one org-mode file and tangle them afterwards. Therefore I produced
>>> the following a.org:
>>>
>>> -->8--
>>> #+begin_src org :tangle in-a.org
>>>   ,* Foo
>>>   ,** Bar
>>> #+end_src
>>> -->8--
>>>
>>> Then I thought I have to add "org" to the list of known tangle
>>> languages:
>>>
>>>> (add-to-list 'org-babel-tangle-langs '("org" "org"))
>>>
>>> And when I know try a org-babel-tangle for example with
>>>
>>>> (org-babel-tangle-file "a.org") 
>>>
>>> Nothing happens. 
>>>
>>> Can anybody help with what I am doing wrong? 
>>
>> Hi Daniel,
>>
>> Short answer: please add
>>
>> (org-babel-add-interpreter "org")
>>
>> Long answer: I think there is room for improvement in org-babel
>> here. For example, the protective commas are not stripped out on
>> tangling, but I feel that they should be. And we need to clarify in the
>> documentation when org-babel-add-interpreter is needed and when adding
>> to org-babel-tangle-langs is required. I'm adding this to our todo list.
>>
>> Best wishes,
>>
>> Dan
>>
>>
>>>
>>>
>>> Kind regards, Daniel
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Please use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please 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

end of thread, other threads:[~2010-04-26 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-15  8:33 [org-babel] How to tangle "org-mode" files? Daniel Brunner
2010-04-15 17:10 ` Dan Davison
2010-04-16  7:12   ` Daniel Brunner
2010-04-26 14:52     ` 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).