emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Patch] ob-ditaa.el for Cygwin
@ 2013-07-12  5:59 Yujie Wen
  2013-07-12  6:05 ` Jambunathan K
  0 siblings, 1 reply; 6+ messages in thread
From: Yujie Wen @ 2013-07-12  5:59 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org Mode


[-- Attachment #1.1: Type: text/plain, Size: 512 bytes --]

Hi,

  ob-ditaa.el calls Java VM to generate pictures. Unfortunately, Cygwin
doesn't have native Java VM. In order to call the Windows native Java VM
properly, all Cygwin paths pointing to ditaa.jar, the temporary input file
and the output picture file must be changed to Windows native paths, for
example, /home/yujie/ditaa.jar to d:/cygwin/home/yujie/ditaa.jar.

  Here is a patch that detect whether current Emacs is of Cygwin version
and, if so, add `cygpath -w ` to wrap all related pathes.

Regards,
Yujie

[-- Attachment #1.2: Type: text/html, Size: 609 bytes --]

[-- Attachment #2: cygwin.patch --]
[-- Type: application/octet-stream, Size: 1570 bytes --]

diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el
index d3d76e5..63967de 100644
--- a/lisp/ob-ditaa.el
+++ b/lisp/ob-ditaa.el
@@ -86,13 +86,29 @@ This function is called by `org-babel-execute-src-block'."
 	 (java (cdr (assoc :java params)))
 	 (in-file (org-babel-temp-file "ditaa-"))
 	 (eps (cdr (assoc :eps params)))
+	 (jar-file-name (shell-quote-argument
+			 (expand-file-name
+			  (if eps org-ditaa-eps-jar-path org-ditaa-jar-path))))
+	 (emacs-p (string-match "cygwin" (emacs-version)))
+	 (jar-file-name-wrapped
+	  (if emacs-p
+	      ;; Cygwin doesn't have Jave, have to use Windows native Java.
+	      ;; So Cygwin paths must be converted to Windows paths.
+	      (format "`cygpath -w %s`" jar-file-name)
+	    jar-file-name))
+	 (in-file-wrapped
+	  (if emacs-p
+	      (format "`cygpath -w %s`" (org-babel-process-file-name in-file))
+	    (org-babel-process-file-name in-file)))
+	 (out-file-wrapped
+	  (if emacs-p
+	      (format "`cygpath -w %s`" (org-babel-process-file-name out-file))
+	    (org-babel-process-file-name out-file)))
 	 (cmd (concat "java " java " " org-ditaa-jar-option " "
-		      (shell-quote-argument
-		       (expand-file-name
-			(if eps org-ditaa-eps-jar-path org-ditaa-jar-path)))
+		      jar-file-name-wrapped
 		      " " cmdline
-		      " " (org-babel-process-file-name in-file)
-		      " " (org-babel-process-file-name out-file)))
+		      " " in-file-wrapped
+		      " " out-file-wrapped))
 	 (pdf-cmd (when (and (or (string= (file-name-extension out-file) "pdf")
 				 (cdr (assoc :pdf params))))
 		    (concat

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

end of thread, other threads:[~2013-07-17 14:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-12  5:59 [Patch] ob-ditaa.el for Cygwin Yujie Wen
2013-07-12  6:05 ` Jambunathan K
     [not found]   ` <CAHenMCHGzkb9GPuoS2xYifFBohzO2r7hvxp5yztySsL8penbJw@mail.gmail.com>
     [not found]     ` <877ggw2szv.fsf@gmail.com>
2013-07-16  1:23       ` Yujie Wen
2013-07-16  5:34         ` Achim Gratz
2013-07-16 13:34           ` Yujie Wen
2013-07-17 14:21           ` 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).