Is it possible to combine org-babel tangling with ASCII export, so that the tangled file would have ALL of the Org-file's content as comments (preserving indentation etc as the ASCII export does), with the code blocks inserted as non-comments? Basically I want to write the program in literate-programming form in Org mode, but be able to export it into an executable form that's independent of Org but still has all the information (not just the text immediately before each code block). Thanks for help, ilya
Yes this is possible, see the "org" argument to the "comment" header argument http://orgmode.org/manual/comments.html. Cheers, Ilya Shlyakhter <ilya_shl@alum.mit.edu> writes: > Is it possible to combine org-babel tangling with ASCII export, so that > the tangled file would have ALL of the Org-file's content > as comments (preserving indentation etc as the ASCII export does), > with the code blocks inserted as non-comments? > > Basically I want to write the program in literate-programming form in > Org mode, but be able to export it into an executable form that's > independent of Org but still has all the information (not just the > text immediately before each code block). > > Thanks for help, > > ilya > > -- Eric Schulte http://cs.unm.edu/~eschulte/
[-- Attachment #1: Type: text/plain, Size: 984 bytes --] Ilya Shlyakhter <ilya_shl@alum.mit.edu> writes: >>Yes this is possible, see the "org" argument to the "comment" header > argument http://orgmode.org/manual/comments.html. > > Right, I saw that, but it has the following limitation: > >>The text is picked from the leading context of the tangled code and is > limited by the nearest headline or source block as the case may be. > > I want all text from the Org file included, not just "leading context up to > nearest headline". The above text means "per code block", so the entire file is exported. > I also want the hierarchical structure of the included text preserved, > as done by ASCII export. Please try to tangle the attached file, I believe it is what you want. > (E.g. I want to include high-level documentation and description, as > goes at the top of an elisp file, and which can be broken into > sections/subsections/etc -- not just local documentation before a > given code block). Is that possible? > Yes. Best, [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: something.org --] [-- Type: text/x-org, Size: 356 bytes --] #+Property: comments both #+Property: tangle example.el This is a the top of an Org-mode file. * Headline 1 This is content inside of a headline. | 1 | | 2 | | 3 | | 4 | #+begin_src emacs-lisp (message "code block 1") #+end_src * Headline 2 This is content inside of a secondary headline. #+begin_src emacs-lisp (message "code block 1") #+end_src [-- Attachment #3: Type: text/plain, Size: 995 bytes --] > > thanks, > > ilya > > > On Mon, Mar 26, 2012 at 7:22 AM, Eric Schulte <eric.schulte@gmx.com> wrote: > >> Yes this is possible, see the "org" argument to the "comment" header >> argument http://orgmode.org/manual/comments.html. >> >> Cheers, >> >> Ilya Shlyakhter <ilya_shl@alum.mit.edu> writes: >> >> > Is it possible to combine org-babel tangling with ASCII export, so that >> > the tangled file would have ALL of the Org-file's content >> > as comments (preserving indentation etc as the ASCII export does), >> > with the code blocks inserted as non-comments? >> > >> > Basically I want to write the program in literate-programming form in >> > Org mode, but be able to export it into an executable form that's >> > independent of Org but still has all the information (not just the >> > text immediately before each code block). >> > >> > Thanks for help, >> > >> > ilya >> > >> > >> >> -- >> Eric Schulte >> http://cs.unm.edu/~eschulte/ >> -- Eric Schulte http://cs.unm.edu/~eschulte/
[-- Attachment #1: Type: text/plain, Size: 1658 bytes --] >Yes this is possible, see the "org" argument to the "comment" header argument http://orgmode.org/manual/comments.html. Right, I saw that, but it has the following limitation: >The text is picked from the leading context of the tangled code and is limited by the nearest headline or source block as the case may be. I want all text from the Org file included, not just "leading context up to nearest headline". I also want the hierarchical structure of the included text preserved, as done by ASCII export. (E.g. I want to include high-level documentation and description, as goes at the top of an elisp file, and which can be broken into sections/subsections/etc -- not just local documentation before a given code block). Is that possible? thanks, ilya On Mon, Mar 26, 2012 at 7:22 AM, Eric Schulte <eric.schulte@gmx.com> wrote: > Yes this is possible, see the "org" argument to the "comment" header > argument http://orgmode.org/manual/comments.html. > > Cheers, > > Ilya Shlyakhter <ilya_shl@alum.mit.edu> writes: > > > Is it possible to combine org-babel tangling with ASCII export, so that > > the tangled file would have ALL of the Org-file's content > > as comments (preserving indentation etc as the ASCII export does), > > with the code blocks inserted as non-comments? > > > > Basically I want to write the program in literate-programming form in > > Org mode, but be able to export it into an executable form that's > > independent of Org but still has all the information (not just the > > text immediately before each code block). > > > > Thanks for help, > > > > ilya > > > > > > -- > Eric Schulte > http://cs.unm.edu/~eschulte/ > [-- Attachment #2: Type: text/html, Size: 2439 bytes --]
[-- Attachment #1: Type: text/plain, Size: 1257 bytes --] >>> The text is picked from the leading context of the tangled code and is >> limited by the nearest headline or source block as the case may be. >> >> I want all text from the Org file included, not just "leading context up to >> nearest headline". > > The above text means "per code block", so the entire file is exported. > >> I also want the hierarchical structure of the included text preserved, >> as done by ASCII export. > > Please try to tangle the attached file, I believe it is what you want. Not quite: in the file you sent, "This is a the top of an Org-mode file." is not included in the tangled file. Also, in the slightly expanded version of your example I'm attaching, the high-level comments at the top of the file are not included. Also, when I nest another headline inside "Headline 1", only the content of that headline -- not of Headline 1 -- is included. I'm attaching the current result of tangling, as well as what I ideally want. example-idea.el was produced by doing an ASCII export, then commenting everything in it except the code blocks. The resulting file is both fully executable and contains everything from the original org file, so it stands on its own and is independent of Emacs/Org. Thanks for help, ilya [-- Attachment #2: something.org --] [-- Type: text/plain, Size: 615 bytes --] #+Property: comments both #+Property: tangle example.el This is a the top of an Org-mode file. * This is some high-level documentation This file does X and Y. *** Section A High-level documentation for functionality A. *** Section B High-level documentation for functionality B. * Headline 1 This is content inside of a headline. *** And this is the info about the block. | 1 | | 2 | | 3 | | 4 | #+begin_src emacs-lisp (message "code block 1") #+end_src * Headline 2 This is content inside of a secondary headline. #+begin_src emacs-lisp (message "code block 1") #+end_src [-- Attachment #3: example.el --] [-- Type: text/plain, Size: 585 bytes --] ;; And this is the info about the block. ;; | 1 | ;; | 2 | ;; | 3 | ;; | 4 | ;; [[git:/cvar/selection/sweep2/nsvn/Tools/org/devel2/org-mode/something.org::fix-colview-todo-by-itself@{2012-03-26}][And-this-is-the-info-about-the-block\.:1]] (message "code block 1") ;; And-this-is-the-info-about-the-block\.:1 ends here ;; Headline 2 ;; This is content inside of a secondary headline. ;; [[git:/cvar/selection/sweep2/nsvn/Tools/org/devel2/org-mode/something.org::fix-colview-todo-by-itself@{2012-03-26}][Headline-2:1]] (message "code block 1") ;; Headline-2:1 ends here [-- Attachment #4: example-ideal.el --] [-- Type: text/plain, Size: 1127 bytes --] ;; This is a the top of an Org-mode file. ;; ====================================== ;; ;; Author: Ilya Shlyakhter ;; Date: 2012-03-26 11:50:40 EDT ;; ;; ;; ;; Table of Contents ;; ================= ;; 1 This is some high-level documentation ;; 1.1 Section A ;; 1.2 Section B ;; 2 Headline 1 ;; 2.1 And this is the info about the block. ;; 3 Headline 2 ;; ;; ;; 1 This is some high-level documentation ;; ---------------------------------------- ;; ;; This file does X and Y. ;; ;; 1.1 Section A ;; ============== ;; ;; High-level documentation for functionality A. ;; ;; 1.2 Section B ;; ============== ;; ;; High-level documentation for functionality B. ;; ;; 2 Headline 1 ;; ------------- ;; ;; This is content inside of a headline. ;; ;; 2.1 And this is the info about the block. ;; ========================================== ;; ;; 1 ;; 2 ;; 3 ;; 4 (message "code block 1") ;; 3 Headline 2 ;; ------------- ;; This is content inside of a secondary headline. (message "code block 1")