From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: [PATCH] Let ob-C and ob-fortran work correctly on Windows/Cygwin Date: Wed, 25 Jul 2012 19:11:04 +0200 Message-ID: <87d33jdavr.fsf@Rainer.invalid> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su57K-0001W4-S7 for emacs-orgmode@gnu.org; Wed, 25 Jul 2012 13:11:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Su57J-00074d-GY for emacs-orgmode@gnu.org; Wed, 25 Jul 2012 13:11:22 -0400 Received: from plane.gmane.org ([80.91.229.3]:41497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su57J-00074V-9H for emacs-orgmode@gnu.org; Wed, 25 Jul 2012 13:11:21 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Su57H-0007k0-0k for emacs-orgmode@gnu.org; Wed, 25 Jul 2012 19:11:19 +0200 Received: from pd9eb5e56.dip.t-dialin.net ([217.235.94.86]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Jul 2012 19:11:18 +0200 Received: from Stromeko by pd9eb5e56.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Jul 2012 19:11:18 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Let-ob-C-and-ob-fortran-work-correctly-on-Windows-Cy.patch Content-Description: Let ob-C and ob-fortran work correctly on Windows/Cygwin >From 61310146053cff23972d8926c73d0eedae157190 Mon Sep 17 00:00:00 2001 From: Achim Gratz 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 --=-=-= Content-Type: text/plain 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 --=-=-=--