emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: Andrew Hyatt <ahyatt@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug in org-babel-load-file
Date: Sun, 07 Feb 2010 00:00:37 -0500	[thread overview]
Message-ID: <87r5oxabd6.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <c8389b601002061922y96bb9d5g3d1243c0c07c3b5d@mail.gmail.com> (Andrew Hyatt's message of "Sat, 6 Feb 2010 22:22:48 -0500")

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

Andrew Hyatt <ahyatt@gmail.com> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-babel-Fix-tangle-file-names-with-multiple-.-s.patch --]
[-- Type: text/x-diff, Size: 1385 bytes --]

From c16fcd05e8d0cc7c9a704ac285d1e5f8f3b3d835 Mon Sep 17 00:00:00 2001
From: Dan Davison <davison@stats.ox.ac.uk>
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


[-- Attachment #3: Type: text/plain, Size: 247 bytes --]



>
> 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

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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-02-07  5:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-07  3:22 Bug in org-babel-load-file Andrew Hyatt
2010-02-07  5:00 ` Dan Davison [this message]
2010-02-07 18:47   ` Eric Schulte

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=87r5oxabd6.fsf@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=ahyatt@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).