emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Dan Davison <davison@stats.ox.ac.uk>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug in org-babel-load-file
Date: Sun, 07 Feb 2010 11:47:35 -0700	[thread overview]
Message-ID: <87wryoublk.fsf@gmail.com> (raw)
In-Reply-To: <87r5oxabd6.fsf@stats.ox.ac.uk> (Dan Davison's message of "Sun, 07 Feb 2010 00:00:37 -0500")

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 <davison@stats.ox.ac.uk> writes:

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

      reply	other threads:[~2010-02-07 18:47 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
2010-02-07 18:47   ` Eric Schulte [this message]

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=87wryoublk.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=davison@stats.ox.ac.uk \
    --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).