emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Let ob-C and ob-fortran work correctly on Windows/Cygwin
@ 2012-07-25 17:11 Achim Gratz
  2012-07-25 18:02 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Achim Gratz @ 2012-07-25 17:11 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Let ob-C and ob-fortran work correctly on Windows/Cygwin
  2012-07-25 17:11 [PATCH] Let ob-C and ob-fortran work correctly on Windows/Cygwin Achim Gratz
@ 2012-07-25 18:02 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2012-07-25 18:02 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Applied, Thanks,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-25 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25 17:11 [PATCH] Let ob-C and ob-fortran work correctly on Windows/Cygwin Achim Gratz
2012-07-25 18:02 ` Eric Schulte

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