From: "Eric Schulte" <schulte.eric@gmail.com>
To: "Sébastien Vauban" <wxhgmqzgwmuf@spammotel.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: Literate Programming with Org mode
Date: Mon, 03 Aug 2009 09:38:22 -0600 [thread overview]
Message-ID: <m2tz0ovr92.fsf@gmail.com> (raw)
In-Reply-To: <87r5vtffv4.fsf@mundaneum.com> ("Sébastien Vauban"'s message of "Mon, 03 Aug 2009 10:42:23 +0200")
Hi Sébastien,
Thanks for giving this a try, comments below...
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> "Eric Schulte" wrote:
>> "Eric Schulte" <schulte.eric@gmail.com> writes:
[...]
>>> As source-code blocks are already named in the current org-babel setup this
>>> wouldn't be a very significant change. Once this is added it shouldn't be
>>> difficult to expand these links/references on export.
>
> Excellent.
>
>
>>> Under this new setup the example file you described would be analogous
>>> to the this org-mode file.
>>>
>>> Does this sound like it would accomplish most of what you are after?
>
> I think so, yes. I'll scan all my Nuweb and noweb files over the past years,
> but I am positive you cover all of my needs -- with the exception of one, but
> I guess it's solvable somehow: the fact that the code should be included via
> the LaTeX `listings' package (thus, colored contextually to the programming
> language) and not as verbatim.
>
I agree fontified code would certainly be preferable to the current
approach of inserting source-code as verbatim. This seems to be a
general org-mode development issue rather than org-babel specific, so
I'm happy to push the buck on this one :). I don't know much about the
listings package, but would another possibly be easier to use htmlize.el
(used for fontification on html export) along with html -> latex
conversion?
>
>
>> With the newest version of org-babel [1]
>
> Done: `git pull'.
>
Please do another git pull before trying the steps below so we can be
sure we're working off the same code base.
> >
>> try opening the attached org-mode file [2] which is an org-mode
>> translation of Sébastien's noweb file from his previous email.
>
> I wanted to translate it in Org. You've been much quicker than I currently am.
> Thanks.
>
>
>> Calling `org-babel-tangle' from within this file will create the
>> Payment.sql, Lessons.sql, and Enterprise.sql source-code files.
>
> Nope...
>
> Open ~/Personal/Templates/org-babel-lit-prog.org
> tangled 0 source-code blocks
>
> I don't understand why.
>
Me either... I'm not sure what could be different about our two
environments that could be causing this problem. Maybe it has to do
with the
--8<---------------cut here---------------start------------->8---
(setq org-odd-levels-only t)
--8<---------------cut here---------------end--------------->8---
that you mention below. Also note that with org-babel by default
source-code blocks are not tangled, only those with a :tangle header
argument will be tangled to source-code files. So for example
--8<---------------cut here---------------start------------->8---
#+srcname: sql-init
#+begin_src sql
-- <<sql-init>>
SELECT abcID, etpID, etpAssurATPolNum
FROM enterprise JOIN record
ON (etpAbcID_fk = abcID)
WHERE etpAbcID_fk
-- <<sql-cond>>
#+end_src
--8<---------------cut here---------------end--------------->8---
will not be tangled, while
--8<---------------cut here---------------start------------->8---
#+srcname: enterprise
#+begin_src sql :tangle Enterprise
-- <<sql-init>>
SELECT abcID, etpID, etpAssurATPolNum
FROM enterprise JOIN record
ON (etpAbcID_fk = abcID)
WHERE etpAbcID_fk
-- <<sql-cond>>
#+end_src
--8<---------------cut here---------------end--------------->8---
will be tangled.
I have changed the original org-babel-lit-prog.org so that it should
work with your configuration of odd levels only and posted it up here
[1].
Note that you can grab all of these referenced files by cloning the
git repo at git://github.com/eschulte/noweb-example.git.
By calling org-babel-tangle from within this org-mode file I was able to
generate Enterprise.sql [2], Lessons.sql [3], and Payment.sql [4].
>
> Is it normal that you don't include the extension in the tangle property?
> Does it add the language extension automatically?
>
>
Yes, org-babel adds the language specific extension automatically. This
could be changed/overridden if it proves to limiting. It grew out of
the fact that originally source-code files were named based upon the
basename of the org-mode file and the language extension.
>
>> The document can also be exported into html and latex using org-mode's
>> standard export functionality.
>
> I have problems as well...
>
Again maybe this is the result of conflicting values of
org-odd-levels-only? Please try this with the newer org-mode file [1].
I was able to export this to latex resulting in the following tex file
[5] and pdf file [6]. I was also able to export this file to html which
includes code highlighting [7].
[...]
> BTW, what do you think of my proposal to include the Tangle process as a
> built-in step of the export to LaTeX (and HTML)?
>
> That way, we only would export and get both flies caught with one stone.
>
I like that idea, once this is working as two separate processes it
should be relatively trivial to optionally hook org-babel-tangle onto
the other export commands.
>
> Thanks for all! This is seriously a hot topic you've almost solved...
>
> Seb
Sorry I can't be more specific with answers to your problems tangling
and exporting. Please do give the new org-mode file [1] a try with the
latest version org-babel and let me know if the problems persist.
Cheers -- Eric
Footnotes:
[1] http://github.com/eschulte/noweb-example/raw/a130e165c79c8f6c2f5147330fe4ae5ab6428c17/w-babel/org-babel-lit-prog.org
[2] http://github.com/eschulte/noweb-example/raw/a130e165c79c8f6c2f5147330fe4ae5ab6428c17/w-babel/Enterprise.sql
[3] http://github.com/eschulte/noweb-example/raw/a130e165c79c8f6c2f5147330fe4ae5ab6428c17/w-babel/Lessons.sql
[4] http://github.com/eschulte/noweb-example/raw/a130e165c79c8f6c2f5147330fe4ae5ab6428c17/w-babel/Payment.sql
[5] http://github.com/eschulte/noweb-example/raw/a130e165c79c8f6c2f5147330fe4ae5ab6428c17/w-babel/org-babel-lit-prog.tex
[6] http://github.com/eschulte/noweb-example/raw/a130e165c79c8f6c2f5147330fe4ae5ab6428c17/w-babel/org-babel-lit-prog.pdf
[7] http://github.com/eschulte/noweb-example/raw/a130e165c79c8f6c2f5147330fe4ae5ab6428c17/w-babel/org-babel-lit-prog.html
next prev parent reply other threads:[~2009-08-03 15:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-28 16:14 Literate Programming with Org mode Sébastien Vauban
2009-07-28 16:46 ` Marcelo de Moraes Serpa
2009-07-28 20:41 ` Sébastien Vauban
2009-07-28 21:53 ` sam kleinman
2009-07-29 22:16 ` Eric H. Neilsen, Jr.
2009-07-31 17:01 ` Eric Schulte
2009-07-31 20:30 ` sam kleinman
2009-07-30 0:42 ` Eric Schulte
2009-08-02 1:46 ` Eric Schulte
2009-08-03 8:42 ` Sébastien Vauban
2009-08-03 15:38 ` Eric Schulte [this message]
2009-08-11 9:42 ` Sébastien Vauban
2009-08-11 18:55 ` Eric Schulte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2tz0ovr92.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=wxhgmqzgwmuf@spammotel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).