emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: Nicolas Girard <nicolas.girard@nerim.net>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [babel] org-babel: tangling to latex .sty/.cls files
Date: Wed, 17 Mar 2010 11:24:02 -0400	[thread overview]
Message-ID: <87iq8vynsd.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <51b0095d1003161510w1f94a1cfk60076dc2d5a5b6f4@mail.gmail.com> (Nicolas Girard's message of "Tue, 16 Mar 2010 23:10:17 +0100")

Unless I hear views to the contrary from other org-babel users, I'm
going to change this later today so that, when a file name is supplied
for tangling, org-babel no longer attempts to guess the file
extension. The only situation when tangling will guess the file name
extension is if you supply ':tangle yes' in which case the behaviour
will be as it is currently (i.e. the org file name, minus .org, plus the
extension defined in org-babel-tangle-langs.)

The patch I propose to apply is below.

For a file named z.org, here are what some blocks will tangle to with
this patch.

#+begin_src sh :tangle yes                => z.sh
#+begin_src latex :tangle latex-code      => latex-code
#+begin_src latex :tangle latex-code.tex  => latex-code.tex
#+begin_src latex :tangle a.cls           => a.cls

Dan


--8<---------------cut here---------------start------------->8---
diff --git a/contrib/babel/lisp/org-babel-tangle.el b/contrib/babel/lisp/org-babel-tangle.el
index dd76195..4880118 100644
--- a/contrib/babel/lisp/org-babel-tangle.el
+++ b/contrib/babel/lisp/org-babel-tangle.el
@@ -109,7 +109,7 @@ exported source code blocks by language."
                                       target-file))
                        (file-name (when base-name
                                     ;; decide if we want to add ext to base-name
-                                    (if (and ext (not (string= (file-name-extension base-name) ext)))
+                                    (if (and ext (string= "yes" tangle))
                                         (concat base-name "." ext) base-name))))
                   ;; ;; debugging
                   ;; (message
--8<---------------cut here---------------end--------------->8---


Nicolas Girard <nicolas.girard@nerim.net> writes:

> Hi all,
> a while ago Babel allowed latex code to be tangled to a file named
> f.sty or f.cls ; it's currently not possible any more, because the
> tangled file is named f.sty.tex or f.cls.tex.
> I tried to deal with it but I'm really missing this feature a lot.
> Do you think org-babel could allow this again ?

> Thanks very much in advance,
> cheers,
> Nicolas
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-03-17 15:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 22:10 org-babel: tangling to latex .sty/.cls files Nicolas Girard
2010-03-17 15:24 ` Dan Davison [this message]
2010-03-17 15:32   ` [babel] " Chris Gray
2010-03-17 16:24     ` Thomas S. Dye
2010-03-18  1:13       ` Dan Davison
2010-03-18 18:09         ` Nicolas Girard
2010-03-18 18:36           ` Dan Davison
2010-03-19 16:18             ` Nicolas Girard
2010-03-17 17:21     ` Dan Davison

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=87iq8vynsd.fsf@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicolas.girard@nerim.net \
    /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).