emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Bug in org-babel-load-file


From: Dan Davison
Subject: Re: [Orgmode] Bug in org-babel-load-file
Date: Sun, 07 Feb 2010 00:00:37 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Andrew Hyatt <address@hidden> writes:

> Hi guys,
>
> There appears to be a bug in org-babel-load-file, where it calls
> org-babel-tangle-file with file and base-name.  Instead of using
> base-name, it should probably use the exported-file.   This causes an
> issue where the elisp I am extracting is put in "foo.bar" instead of
> "foo.bar.el".  Strangely, this doesn't appear to always happen, but
> only when there is a file with lots of dot-separated sections.  Any
> thoughts?

Hi Andrew,

Yes I can replicate that, when file names contain multiple '.'s.  I
think the patch below provides a quick fix. However, this patch would
not allow e.g. tangling elisp to a file with a name like 'foo.el.el', in
case anyone wants to do that.

Dan

>From c16fcd05e8d0cc7c9a704ac285d1e5f8f3b3d835 Mon Sep 17 00:00:00 2001
From: Dan Davison <address@hidden>
Date: Sat, 6 Feb 2010 23:50:34 -0500
Subject: [PATCH] babel: Fix tangle file names with multiple '.'s

---
 contrib/babel/lisp/org-babel-tangle.el |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/babel/lisp/org-babel-tangle.el 
b/contrib/babel/lisp/org-babel-tangle.el
index d75f1d2..5cfdca5 100644
--- a/contrib/babel/lisp/org-babel-tangle.el
+++ b/contrib/babel/lisp/org-babel-tangle.el
@@ -108,10 +108,10 @@ exported source code blocks by language."
                                        ((> (length tangle) 0) tangle))
                                       target-file))
                        (file-name (when base-name
-                                    (if (and ext
-                                             (string= base-name
-                                                      
(file-name-sans-extension base-name)))
-                                        (concat base-name "." ext) 
base-name))))
+                                   (if ext
+                                       (if (string= (file-name-extension 
base-name) ext)
+                                           base-name (concat base-name "." 
ext))
+                                     base-name))))
                   ;; ;; debugging
                   ;; (message
                   ;;  "tangle=%S base-name=%S file-name=%S she-bang=%S 
commentable=%s"
-- 
1.6.3.3


>
> This is in org 6.34trans.
>
>
> _______________________________________________
> 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]