emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Girard <nicolas.girard@nerim.net>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: org-babel-tangle tangles too much !
Date: Tue, 1 Dec 2009 18:55:20 +0100	[thread overview]
Message-ID: <51b0095d0912010955i5d93b3e2lbf17369048556970@mail.gmail.com> (raw)
In-Reply-To: <51b0095d0912010654y32b109b1hb3795e86cf6e0416@mail.gmail.com>

On Tue, 01 Dec 2009 05:43:38 -1000, Thomas S. Dye wrote :
>
> Your code snippet doesn't tangle at all here.  Perhaps you have a
> setting somewhere that has an effect on tangling?
>

I'm intending my file (username.org) to be processed by Eric's
emacs-starter-kit during init (via org-babel-load-file I guess).

As none of the other starter-kit.org seemed to bother with ":tangle
yes" I didn't either.

On Tue, 01 Dec 2009 11:26:28 -0500, Dan Davison wrote :
>
> Note that all header arguments (including :tangle) get appended to
> the #+begin_src line and *not* to the #+srcname line, although it is
> an easy mistake to make.

Sure, I've been mistaken while posting my message but havent when
performing my tests. You're right that it's quite error prone.

On Tue, 01 Dec 2009 08:53:37 -0700, Eric Schulte wrote :
> #+srcname: b
> #+begin_src emacs-lisp :noweb no

I'm afraid I don't understand the meaning of the "noweb" option here,
or elsewhere in threads about org-babel. On [1] it can be read that
"the org-babel-tangle function (...) makes use of Noweb reference
syntax for tangling of code files" ; what it means to me is that
org-babel-tangle borrowed noweb's syntax but is completely independant
from it, am I wrong ?

[1] http://orgmode.org/worg/org-contrib/babel/org-babel.php#literate-programming

> If you can make a good case for why the behavior you describe should be
> supported then we could try to add it behind something like a
> (...)
> header argument, but at first blush the option seems to present too much
> opportunity for confusion.  Maybe I'm missing something.

I for sure must also be missing something ; hopefully the following
example will get things clarified to both of us:

Using your emacs-starter-kit, here's an excerpt of how I would like my
username.org to look like:

#---- begin username.org
* Publishing

** Default headers and document class

As for the default headers, the associated variable is
=org-export-latex-classes=. I choose to change its contents rather
than appending to it
#
#+begin_src emacs-lisp
(setq org-export-latex-classes '(
 <<org-export-memoir>>
 <<org-export-scrartcl>>
))
#+end_src

*** Configuration for the =memoir= class

#+srcname: org-export-memoir
#+begin_src emacs-lisp
  ("memoir"
  "<<latex_header_memoir>>"
  <<latex_header_sections>>)
#+end_src

#+srcname: latex_header_memoir
#+begin_src emacs-lisp
  \\documentclass[article,a4paper]{memoir}
  <<latex_header_common>>
  <<memoir_correct_article>>
  <<memoir_bug_chapapp>>
#+end_src

=memoir='s article option do not behave correctly with sections. Let's
correct this:
#
#+srcname: memoir_correct_article
#+begin_src emacs-lisp
\\let\\subsubsection\\subsection
\\let\\subsection\\section
\\let\\section\\chapter
#+end_src
#
#+srcname: memoir_bug_chapapp
#+begin_src emacs-lisp
\\makeatletter
\\renewcommand{\\@chapapp}{}
\\makeatother
#+end_src

*** Configuration for the =scrartcl= class

I've been using =memoir= for quite a long time ; but =scrartcl= is now
my default class
#
#+begin_src emacs-lisp
(setq org-export-latex-default-class "article")
#+end_src
#
#+srcname: org-export-scrartcl
#+begin_src emacs-lisp
("article"
"\\documentclass{scrartcl}
<<latex_header_common>>
"
<<latex_header_sections>>
)
#+end_src

*** Common configuration

#+srcname: latex_header_common
#+begin_src emacs-lisp
\\usepackage{tikz}
\\RequirePackage{graphicx}
\\DeclareGraphicsExtensions{.pdf,.png,.jpg,.ps,.eps}
\\RequirePackage[T1]{fontenc}
<<header_common_lang>>
<<header_common_xelatex>>
<<header_common_fonts>>
#+end_src

(... and so on)
#---- end username.org

I expect both

- C-c C-e p to export username.org to username.pdf (this works
  already), and

- org-babel-tangle to generate a proper username.el (broken yet
  because code chunks get written twice).

Is my example clear enough ?

Cheers,
Nicolas

  parent reply	other threads:[~2009-12-01 17:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01 14:54 org-babel-tangle tangles too much ! Nicolas Girard
2009-12-01 15:43 ` Thomas S. Dye
2009-12-01 15:53 ` Eric Schulte
2009-12-01 16:26 ` Dan Davison
2009-12-01 17:55 ` Nicolas Girard [this message]
2009-12-01 18:26   ` Thomas S. Dye
2009-12-01 18:50   ` [babel] " Dan Davison
2009-12-01 20:08     ` [babel] " Nicolas Girard

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=51b0095d0912010955i5d93b3e2lbf17369048556970@mail.gmail.com \
    --to=nicolas.girard@nerim.net \
    --cc=emacs-orgmode@gnu.org \
    /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).