emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] [babel] org-babel: tangling to latex .sty/.cls files


From: Dan Davison
Subject: Re: [Orgmode] [babel] org-babel: tangling to latex .sty/.cls files
Date: Wed, 17 Mar 2010 11:24:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

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 <address@hidden> 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.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode




reply via email to

[Prev in Thread] Current Thread [Next in Thread]