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.
This commit is contained in:
Achim Gratz 2012-07-25 19:09:08 +02:00 committed by Eric Schulte
parent 556f725e5b
commit 2dfa6aaf79
3 changed files with 6 additions and 4 deletions

View file

@ -88,9 +88,7 @@ or `org-babel-execute:C++'."
(cond (cond
((equal org-babel-c-variant 'c) ".c") ((equal org-babel-c-variant 'c) ".c")
((equal org-babel-c-variant 'cpp) ".cpp")))) ((equal org-babel-c-variant 'cpp) ".cpp"))))
(tmp-bin-file (org-babel-temp-file (tmp-bin-file (org-babel-temp-file "C-bin-" org-babel-exeext))
"C-bin-"
(if (equal system-type 'windows-nt) ".exe" "")))
(cmdline (cdr (assoc :cmdline params))) (cmdline (cdr (assoc :cmdline params)))
(flags (cdr (assoc :flags params))) (flags (cdr (assoc :flags params)))
(full-body (org-babel-C-expand body params)) (full-body (org-babel-C-expand body params))

View file

@ -46,7 +46,7 @@
(defun org-babel-execute:fortran (body params) (defun org-babel-execute:fortran (body params)
"This function should only be called by `org-babel-execute:fortran'" "This function should only be called by `org-babel-execute:fortran'"
(let* ((tmp-src-file (org-babel-temp-file "fortran-src-" ".F90")) (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))) (cmdline (cdr (assoc :cmdline params)))
(flags (cdr (assoc :flags params))) (flags (cdr (assoc :flags params)))
(full-body (org-babel-expand-body:fortran body params)) (full-body (org-babel-expand-body:fortran body params))

View file

@ -28,6 +28,10 @@
(require 'ob-eval) (require 'ob-eval)
(require 'org-macs) (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-babel-call-process-region-original)
(defvar org-src-lang-modes) (defvar org-src-lang-modes)
(defvar org-babel-library-of-babel) (defvar org-babel-library-of-babel)