all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Let ob-C and ob-fortran work correctly on Windows/Cygwin
Date: Wed, 25 Jul 2012 19:11:04 +0200	[thread overview]
Message-ID: <87d33jdavr.fsf@Rainer.invalid> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Let ob-C and ob-fortran work correctly on Windows/Cygwin --]
[-- Type: text/x-patch, Size: 2480 bytes --]

From 61310146053cff23972d8926c73d0eedae157190 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Wed, 25 Jul 2012 19:09:08 +0200
Subject: [PATCH] Let ob-C and ob-fortran work correctly on Windows/Cygwin

* lisp/ob.el (org-babel-exeext): New defconst to hold extension for
  executables or nil if none.  Should be ".exe" for both Windows and
  Cygwin.

* lisp/ob-C.el (org-babel-C-execute): Use org-babel-exeext when
  constructing the target file name for the compiled executable.

* lisp/ob-fortran.el (org-babel-execute:fortran): Add org-babel-exeext
  when constructing the target file name for the compiled executable.
---
 lisp/ob-C.el       |    4 +---
 lisp/ob-fortran.el |    2 +-
 lisp/ob.el         |    4 ++++
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index 583510a..aabf198 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -88,9 +88,7 @@ (defun org-babel-C-execute (body params)
 			(cond
 			 ((equal org-babel-c-variant 'c) ".c")
 			 ((equal org-babel-c-variant 'cpp) ".cpp"))))
-         (tmp-bin-file (org-babel-temp-file
-			"C-bin-"
-			(if (equal system-type 'windows-nt) ".exe" "")))
+         (tmp-bin-file (org-babel-temp-file "C-bin-" org-babel-exeext))
          (cmdline (cdr (assoc :cmdline params)))
          (flags (cdr (assoc :flags params)))
          (full-body (org-babel-C-expand body params))
diff --git a/lisp/ob-fortran.el b/lisp/ob-fortran.el
index 491dde3..e068da6 100644
--- a/lisp/ob-fortran.el
+++ b/lisp/ob-fortran.el
@@ -46,7 +46,7 @@ (defvar org-babel-fortran-compiler "gfortran"
 (defun org-babel-execute:fortran (body params)
   "This function should only be called by `org-babel-execute:fortran'"
   (let* ((tmp-src-file (org-babel-temp-file "fortran-src-" ".F90"))
-         (tmp-bin-file (org-babel-temp-file "fortran-bin-"))
+         (tmp-bin-file (org-babel-temp-file "fortran-bin-" org-babel-exeext))
          (cmdline (cdr (assoc :cmdline params)))
          (flags (cdr (assoc :flags params)))
          (full-body (org-babel-expand-body:fortran body params))
diff --git a/lisp/ob.el b/lisp/ob.el
index 4a5f492..8a21708 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -28,6 +28,10 @@
 (require 'ob-eval)
 (require 'org-macs)
 
+(defconst org-babel-exeext
+  (if (memq system-type '(windows-nt cygwin))
+      ".exe"
+    nil))
 (defvar org-babel-call-process-region-original)
 (defvar org-src-lang-modes)
 (defvar org-babel-library-of-babel)
-- 
1.7.10.4


[-- Attachment #2: Type: text/plain, Size: 185 bytes --]


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra

             reply	other threads:[~2012-07-25 17:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 17:11 Achim Gratz [this message]
2012-07-25 18:02 ` [PATCH] Let ob-C and ob-fortran work correctly on Windows/Cygwin 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d33jdavr.fsf@Rainer.invalid \
    --to=stromeko@nexgo.de \
    --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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.