From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Bug in org-babel-load-file Date: Sun, 07 Feb 2010 11:47:35 -0700 Message-ID: <87wryoublk.fsf@gmail.com> References: <87r5oxabd6.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NeCAd-0004zQ-Lv for emacs-orgmode@gnu.org; Sun, 07 Feb 2010 13:47:47 -0500 Received: from [199.232.76.173] (port=54692 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NeCAc-0004zI-B3 for emacs-orgmode@gnu.org; Sun, 07 Feb 2010 13:47:46 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NeCAX-0003to-Gx for emacs-orgmode@gnu.org; Sun, 07 Feb 2010 13:47:46 -0500 Received: from mail-px0-f179.google.com ([209.85.216.179]:60826) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NeCAX-0003tG-5m for emacs-orgmode@gnu.org; Sun, 07 Feb 2010 13:47:41 -0500 Received: by pxi9 with SMTP id 9so5818880pxi.24 for ; Sun, 07 Feb 2010 10:47:39 -0800 (PST) In-Reply-To: <87r5oxabd6.fsf@stats.ox.ac.uk> (Dan Davison's message of "Sun, 07 Feb 2010 00:00:37 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Dan Davison Cc: emacs-orgmode@gnu.org Hi Andrew, I just applied a slight variation of Dan's patch which should fix this issue. Thanks for the bug report, and please let us know if you have any further issues. Cheers -- Eric Dan Davison writes: > Andrew Hyatt 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 > 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"