emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Yujie Wen <yjwen.ty@gmail.com>
To: "emacs-orgmode@gnu.org Mode" <emacs-orgmode@gnu.org>
Subject: Re: [Patch] ob-ditaa.el for Cygwin
Date: Tue, 16 Jul 2013 09:23:35 +0800	[thread overview]
Message-ID: <CAHenMCFoPCwFHKuc1i+6-0WAfCXssa3KYW8WwB_Nu3vVuD0K-w@mail.gmail.com> (raw)
In-Reply-To: <877ggw2szv.fsf@gmail.com>


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

Hi,

  I re-created the patch file by the instruction on "How to contribute to
Org".

  Could someone please take a look and, if it is satisfactory, please help
to apply it?

  I am used to Orgmode under Cygwin and sometimes uses ditaa for drawing
diagrams. But without this patch, I have to switch to Windows native Emacs
for calling ditaa.

  Many thanks

Regards,
Yujie


2013/7/12 Jambunathan K <kjambunathan@gmail.com>

>
> Sorry.
>

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

[-- Attachment #2: 0001-ditaa-for-cygwin-with-Windows-native-Java-VM.patch --]
[-- Type: application/octet-stream, Size: 1895 bytes --]

From c32305315ee0d0f3dd4e7a614607a5af08983143 Mon Sep 17 00:00:00 2001
From: yjwen <yjwen.ty@gmail.com>
Date: Tue, 16 Jul 2013 09:14:45 +0800
Subject: [PATCH] ditaa for cygwin with Windows native Java VM.

---
 lisp/ob-ditaa.el |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

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


  parent reply	other threads:[~2013-07-16  1:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-07-16  5:34         ` Achim Gratz
2013-07-16 13:34           ` Yujie Wen
2013-07-17 14:21           ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHenMCFoPCwFHKuc1i+6-0WAfCXssa3KYW8WwB_Nu3vVuD0K-w@mail.gmail.com \
    --to=yjwen.ty@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).