From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Bug in org-babel-load-file Date: Sun, 07 Feb 2010 00:00:37 -0500 Message-ID: <87r5oxabd6.fsf@stats.ox.ac.uk> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NdzGJ-0007PD-PL for emacs-orgmode@gnu.org; Sun, 07 Feb 2010 00:00:47 -0500 Received: from [199.232.76.173] (port=34263 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NdzGI-0007Oz-6N for emacs-orgmode@gnu.org; Sun, 07 Feb 2010 00:00:46 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NdzGG-0002QD-Be for emacs-orgmode@gnu.org; Sun, 07 Feb 2010 00:00:45 -0500 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:48391) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NdzGF-0002Pz-UB for emacs-orgmode@gnu.org; Sun, 07 Feb 2010 00:00:44 -0500 In-Reply-To: (Andrew Hyatt's message of "Sat, 6 Feb 2010 22:22:48 -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: Andrew Hyatt Cc: emacs-orgmode@gnu.org --=-=-= 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-babel-Fix-tangle-file-names-with-multiple-.-s.patch >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" -- 1.6.3.3 --=-=-= > > This is in org 6.34trans. > > > _______________________________________________ > 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--