emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Let ob-C and ob-fortran work correctly on Windows/Cygwin


From: Achim Gratz
Subject: [O] [PATCH] Let ob-C and ob-fortran work correctly on Windows/Cygwin
Date: Wed, 25 Jul 2012 19:11:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

>From 61310146053cff23972d8926c73d0eedae157190 Mon Sep 17 00:00:00 2001
From: Achim Gratz <address@hidden>
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

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 via email to

[Prev in Thread] Current Thread [Next in Thread]