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

* Re: [Patch] ob-ditaa.el for Cygwin
  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>
  0 siblings, 1 reply; 6+ messages in thread
From: Jambunathan K @ 2013-07-12  6:05 UTC (permalink / raw)
  To: Yujie Wen; +Cc: emacs-orgmode@gnu.org Mode


Have your tried setting the *Windows* environment variable $HOME via
Windows system settings to d:/cygwin/home/yujie?

Yujie Wen <yjwen.ty@gmail.com> writes:

> 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

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

* Re: [Patch] ob-ditaa.el for Cygwin
       [not found]     ` <877ggw2szv.fsf@gmail.com>
@ 2013-07-16  1:23       ` Yujie Wen
  2013-07-16  5:34         ` Achim Gratz
  0 siblings, 1 reply; 6+ messages in thread
From: Yujie Wen @ 2013-07-16  1:23 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org Mode


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


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

* Re: [Patch] ob-ditaa.el for Cygwin
  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
  0 siblings, 2 replies; 6+ messages in thread
From: Achim Gratz @ 2013-07-16  5:34 UTC (permalink / raw)
  To: emacs-orgmode

Yujie Wen writes:
> Could someone please take a look and, if it is satisfactory, please
> help to apply it?

You're missing a Changelog and emacs-p might better be called cygwin-p.

More to the point: I don't think Org should care about such system
idiosyncrasies at all.  Instead you might use a wrapper script for
Cygwin that converts the arguments and then calls the native Windows
java executable.

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

If there's anything to do on the Org side then removing the still
hardcoded call of "java".


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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

* Re: [Patch] ob-ditaa.el for Cygwin
  2013-07-16  5:34         ` Achim Gratz
@ 2013-07-16 13:34           ` Yujie Wen
  2013-07-17 14:21           ` Eric Schulte
  1 sibling, 0 replies; 6+ messages in thread
From: Yujie Wen @ 2013-07-16 13:34 UTC (permalink / raw)
  Cc: emacs-orgmode@gnu.org Mode

[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]

Hi, Achim

  Thanks for your suggestion.

  Yes, a wrapper script will also work. I will use such a script if Org
doesn't consider the Cygwin issue.

Regards,
Yujie


2013/7/16 Achim Gratz <Stromeko@nexgo.de>

> Yujie Wen writes:
> > Could someone please take a look and, if it is satisfactory, please
> > help to apply it?
>
> You're missing a Changelog and emacs-p might better be called cygwin-p.
>
> More to the point: I don't think Org should care about such system
> idiosyncrasies at all.  Instead you might use a wrapper script for
> Cygwin that converts the arguments and then calls the native Windows
> java executable.
>
> > 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.
>
> If there's anything to do on the Org side then removing the still
> hardcoded call of "java".
>
>
> Regards,
> Achim.
> --
> +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
>
> SD adaptation for Waldorf microQ V2.22R2:
> http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
>
>
>

[-- Attachment #2: Type: text/html, Size: 1806 bytes --]

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

* Re: [Patch] ob-ditaa.el for Cygwin
  2013-07-16  5:34         ` Achim Gratz
  2013-07-16 13:34           ` Yujie Wen
@ 2013-07-17 14:21           ` Eric Schulte
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Schulte @ 2013-07-17 14:21 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Achim Gratz <Stromeko@nexgo.de> writes:

> Yujie Wen writes:
>> Could someone please take a look and, if it is satisfactory, please
>> help to apply it?
>
> You're missing a Changelog and emacs-p might better be called cygwin-p.
>
> More to the point: I don't think Org should care about such system
> idiosyncrasies at all.  Instead you might use a wrapper script for
> Cygwin that converts the arguments and then calls the native Windows
> java executable.
>
>> 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.
>
> If there's anything to do on the Org side then removing the still
> hardcoded call of "java".
>

I've just pushed up a configuration variable to allow customization of
the previously hard coded "java".  Set `org-babel-ditaa-java-cmd' to
change this.

>
>
> Regards,
> Achim.

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

^ permalink raw reply	[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).