[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] [babel] Painless integration of source blocks with languag
From: |
Eric Schulte |
Subject: |
Re: [Orgmode] [babel] Painless integration of source blocks with language |
Date: |
Sun, 16 Jan 2011 08:31:03 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Seth Burleigh <address@hidden> 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
- Re: [Orgmode] Re: [babel] Painless integration of source blocks with language, (continued)
Re: [Orgmode] [babel] Painless integration of source blocks with language, Eric S Fraga, 2011/01/10
Re: [Orgmode] [babel] Painless integration of source blocks with language, Eric S Fraga, 2011/01/13
Re: [Orgmode] [babel] Painless integration of source blocks with language, Seth Burleigh, 2011/01/13
Re: [Orgmode] [babel] Painless integration of source blocks with language, Eric Schulte, 2011/01/13
Re: [Orgmode] [babel] Painless integration of source blocks with language, Seth Burleigh, 2011/01/13
Re: [Orgmode] [babel] Painless integration of source blocks with language,
Eric Schulte <=
[Orgmode] Re: [babel] Painless integration of source blocks with language, Sébastien Vauban, 2011/01/17
Re: [Orgmode] Re: [babel] Painless integration of source blocks with language, Eric Schulte, 2011/01/17
[Orgmode] Re: [babel] Painless integration of source blocks with language, Sébastien Vauban, 2011/01/17
Re: [Orgmode] [babel] Painless integration of source blocks with language, Seth Burleigh, 2011/01/17
[Orgmode] Re: [babel] Painless integration of source blocks with language, Sébastien Vauban, 2011/01/17
Re: [Orgmode] Re: [babel] Painless integration of source blocks with language, Seth Burleigh, 2011/01/18
Re: [Orgmode] Re: [babel] Painless integration of source blocks with language, Seth Burleigh, 2011/01/18
Re: [Orgmode] Re: [babel] Painless integration of source blocks with language, Seth Burleigh, 2011/01/18
Re: [Orgmode] Re: [babel] Painless integration of source blocks with language, Eric Schulte, 2011/01/19
Re: [Orgmode] Re: [babel] Painless integration of source blocks with language, Seth Burleigh, 2011/01/24