emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: [babel] Painless integration of source blocks with lan


From: Seth Burleigh
Subject: Re: [Orgmode] Re: [babel] Painless integration of source blocks with language
Date: Mon, 24 Jan 2011 08:49:24 -0600

> You are correct, while the tangling works, the detangling still needs to
> be updated to take into account the fact that there may now be nested
> sections of tangled code -- which it doesn't currently.  Hopefully this
> wont be too large of a code change...
>

It probably wouldnt involve much code change, since there is very few
functions which operate on tangled files - detangle and jump to source
block?
It would be a good time to implement some functions, maybe like this,
which did operate on tangled files -

org-babel-detangle-src-block-info
which, given a point on the line of a link, would produced something like
((end . '(0 100)) (middle . (10 90)) (children . (((end . (20 30))
...) ... more children))
where end is the position in the buffer from the beginning of the link
to the end of the matching end link, and middle is the body portion.

. Then define a function which maps over
all of the detangled toplevel src blocks of a file(like what is done
for tangled src blocks).

And then one could call org-babel-detangle-src-block which would do
some recursive detangling


if has children, detangle children
get body string
replace the children in body string (using end) with appropriate noweb syntax
replace appropriate org block with code

and then you could call org-babel-detangle which would detangle all of
a file, using the map function mentioned previously to collect all
source blocks.

(with-error
  detangle all toplevel blocks of file
)

where with-error will catch any errors, replace org file with original
content if an error is thrown, and then reraise the error.



reply via email to

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