emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: "Martin G. Skjæveland" <martige@ifi.uio.no>
Cc: emacs-orgmode@gnu.org
Subject: Re: [babel] tangle and Makefile
Date: Thu, 28 Jan 2010 10:38:00 -0500	[thread overview]
Message-ID: <87iqamqlyf.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <4B616C72.2000707@ifi.uio.no> ("Martin G. Skjæveland"'s message of "Thu, 28 Jan 2010 11:52:34 +0100")

"Martin G. Skjæveland" <martige@ifi.uio.no> writes:

> Hi,
>
> I have two questions regarding org-babel-tangle and Makefile.
>
> Running org-babel-tangle on the following file
>
> ----------------------------------start
> * test
>
> #+begin_src makefile :tangle Makefile
>   test:
>           echo "hello"
> #+end_src
> ----------------------------------end
>
> writes a file 'Makefile.' (with a period). Is it possible to have it
> write to a file named 'Makefile' (without a period)?

Hi Martin,

I've had this problem too. Here's a patch. Eric -- can you apply if
it looks OK?

Dan

From 5c4d56a2e43a97186bf2971b6406f5fa2257130d Mon Sep 17 00:00:00 2001
From: Dan Davison <davison@stats.ox.ac.uk>
Date: Thu, 28 Jan 2010 10:23:11 -0500
Subject: [PATCH] babel: prevent trailing periods in tangled file names without extensions

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

diff --git a/contrib/babel/lisp/org-babel-tangle.el b/contrib/babel/lisp/org-babel-tangle.el
index c805373..66e2c26 100644
--- a/contrib/babel/lisp/org-babel-tangle.el
+++ b/contrib/babel/lisp/org-babel-tangle.el
@@ -102,9 +102,10 @@ exported source code blocks by language."
                                      ((> (length tangle) 0) tangle))
                                     target-file))
                      (file-name (when base-name
-                                  (if (string= base-name
-                                               (file-name-sans-extension base-name))
-                                      (concat base-name "." ext) base-name))))
+                                  (if (and ext
+                                          (string= base-name
+                                                   (file-name-sans-extension base-name)))
+                                     (concat base-name "." ext) base-name))))
                 ;; ;; debugging
                 ;; (message "tangle=%S base-name=%S file-name=%S"
                 ;;          tangle base-name file-name)
-- 
1.6.3.3

  reply	other threads:[~2010-01-28 15:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-28 10:52 [babel] tangle and Makefile "Martin G. Skjæveland"
2010-01-28 15:38 ` Dan Davison [this message]
2010-01-28 17:00   ` Eric Schulte
2010-01-28 15:47 ` sometimes we don't want org-src to remove tabs [WAS: Re: tangle and Makefile]] Dan Davison
2010-01-28 18:21   ` Carsten Dominik
2010-01-29 15:28     ` Dan Davison

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=87iqamqlyf.fsf@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=martige@ifi.uio.no \
    /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).