Seth Burleigh <[email protected]> writes:
>>As for how to trace back through noweb links, the best option seem to be
>>using the existing jump function to navigate from raw source to the
>>embedded block, keeping track of the point's offset form the beginning
>>of the block, then using `org-babel-expand-src-block' to expand the body
>>of the embedded code block marking noweb references with text properties
>>as they are inserted into the expanding body, and then using the point
>>offset to place the point into the appropriate noweb reference. This
>>process could then recurse on the embedded noweb code block until it
>>ends up in a non-noweb portion of an expanded code block body.
>
> If you dont have any comment anchors in the text, how would you know which
> noweb block you are in? If your org file and raw files are synched, then
> you could, but if they become unsynched, which is the way it should be
> (change raw code until done, then detangle to org), i dont exactly see how
> you can do it.
>
Yea, I think you're right. I can't come up with any way of marking or
remembering the boundaries of noweb reference sections without inserting
comment wrappers around such sections.
I've just pushed up a new header argument combination ":comments noweb"
which will wrap all embedded noweb sections in link comments, as
demonstrated in the following example. Hopefully this should be
sufficient for a complete mapping from a pure code file back to the
original org-mode file.
#+source: wrappable
#+begin_src emacs-lisp
(setq x (+ 4 x))
#+end_src
#+begin_src emacs-lisp :comments noweb :noweb yes :tangle yes
(let ((x 1))
(message "x=%s" x)
<<wrappable>>
(message "x=%s" x))
#+end_src
which tangles out the following emacs-lisp
#+begin_src emacs-lisp
;;
[[file:~/src/babel-dev/scraps.org::*wrap%20noweb%20references%20in%20comments][wrap-noweb-references-in-comments:2]]
(let ((x 1))
(message "x=%s" x)
;;
[[file:~/src/babel-dev/scraps.org::*wrap%20noweb%20references%20in%20comments][wrappable]]
(setq x (+ 4 x))
;; wrappable ends here
(message "x=%s" x))
;; wrap-noweb-references-in-comments:2 ends here
#+end_src
Cheers -- Eric
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-orgmode