emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ob-java.el: Add header argument to pass command line args
@ 2019-11-06 10:29 Jarmo Hurri
  2019-11-22  5:12 ` Jarmo Hurri
  2020-02-12 11:54 ` Bastien
  0 siblings, 2 replies; 7+ messages in thread
From: Jarmo Hurri @ 2019-11-06 10:29 UTC (permalink / raw)
  To: emacs-orgmode

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


... attached

Jarmo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1497 bytes --]

From bbc3f977d6b98240834af8fb009a2a080813f30b Mon Sep 17 00:00:00 2001
From: Jarmo Hurri <jarmo.hurri@iki.fi>
Date: Wed, 6 Nov 2019 12:21:16 +0200
Subject: [PATCH] ob-java.el: Add header argument to pass command line args.

* lisp/ob-java.el (org-babel-execute:java): Handle new header argument `:cmdargs` and pass its value as the last element in call to java.
---
 lisp/ob-java.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-java.el b/lisp/ob-java.el
index b055f85e5..80308ec32 100644
--- a/lisp/ob-java.el
+++ b/lisp/ob-java.el
@@ -58,6 +58,7 @@ parameters may be used, like javac -verbose"
 	 (src-file (concat classname ".java"))
 	 (cmpflag (or (cdr (assq :cmpflag params)) ""))
 	 (cmdline (or (cdr (assq :cmdline params)) ""))
+	 (cmdargs (or (cdr (assq :cmdargs params)) ""))
 	 (full-body (org-babel-expand-body:generic body params)))
     (with-temp-file src-file (insert full-body))
     (org-babel-eval
@@ -66,7 +67,7 @@ parameters may be used, like javac -verbose"
     (unless (or (not packagename) (file-exists-p packagename))
       (make-directory packagename 'parents))
     (let ((results (org-babel-eval (concat org-babel-java-command
-                                           " " cmdline " " classname) "")))
+                                           " " cmdline " " classname " " cmdargs) "")))
       (org-babel-reassemble-table
        (org-babel-result-cond (cdr (assq :result-params params))
 	 (org-babel-read results)
-- 
2.21.0


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

* Re: [PATCH] ob-java.el: Add header argument to pass command line args
  2019-11-06 10:29 [PATCH] ob-java.el: Add header argument to pass command line args Jarmo Hurri
@ 2019-11-22  5:12 ` Jarmo Hurri
  2019-11-24  9:14   ` Nicolas Goaziou
  2020-02-12 11:54 ` Bastien
  1 sibling, 1 reply; 7+ messages in thread
From: Jarmo Hurri @ 2019-11-22  5:12 UTC (permalink / raw)
  To: emacs-orgmode


Greetings.

Any hope of this super tiny patch being applied? It addresses the
problem I brought up in another thread: it is currently not possible to
pass command line arguments to a java program.

All the best,

Jarmo

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

* Re: [PATCH] ob-java.el: Add header argument to pass command line args
  2019-11-22  5:12 ` Jarmo Hurri
@ 2019-11-24  9:14   ` Nicolas Goaziou
  2019-12-01 10:33     ` Jarmo Hurri
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2019-11-24  9:14 UTC (permalink / raw)
  To: Jarmo Hurri; +Cc: emacs-orgmode

Hello,

Jarmo Hurri <jarmo.hurri@iki.fi> writes:

> Any hope of this super tiny patch being applied? It addresses the
> problem I brought up in another thread: it is currently not possible to
> pass command line arguments to a java program.

Org 9.3 is feature frozen for the time being. Do you think this
qualifies as a bugfix or as a new feature? In the latter case, could you
rebase it on top of "next" branch and add an entry in ORG-NEWS, under
"Org 9.4" section?

Thank you!

Regards,

-- 
Nicolas Goaziou

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

* Re: [PATCH] ob-java.el: Add header argument to pass command line args
  2019-11-24  9:14   ` Nicolas Goaziou
@ 2019-12-01 10:33     ` Jarmo Hurri
  2019-12-27  8:00       ` Jarmo Hurri
  0 siblings, 1 reply; 7+ messages in thread
From: Jarmo Hurri @ 2019-12-01 10:33 UTC (permalink / raw)
  To: emacs-orgmode

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

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> Any hope of this super tiny patch being applied? It addresses the
>> problem I brought up in another thread: it is currently not possible
>> to pass command line arguments to a java program.
>
> Org 9.3 is feature frozen for the time being. Do you think this
> qualifies as a bugfix or as a new feature? 

More of a new feature, I guess.

> In the latter case, could you rebase it on top of "next" branch and
> add an entry in ORG-NEWS, under "Org 9.4" section?

I did my best; see attachments. There was no 9.4 section in ORG-NEWS, so
I added my entry under "Version Next". Are these ok?

Jarmo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: babel --]
[-- Type: text/x-patch, Size: 1502 bytes --]

From 5089053f4f3f916dfbdab009d28b16ffac6f9055 Mon Sep 17 00:00:00 2001
From: Jarmo Hurri <jarmo.hurri@iki.fi>
Date: Wed, 6 Nov 2019 12:21:16 +0200
Subject: [PATCH 1/2] ob-java.el: Add header argument to pass command line
 args.

* lisp/ob-java.el (org-babel-execute:java): Handle new header argument `:cmdargs` and pass its value as the last element in call to java.
---
 lisp/ob-java.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-java.el b/lisp/ob-java.el
index b055f85e5..80308ec32 100644
--- a/lisp/ob-java.el
+++ b/lisp/ob-java.el
@@ -58,6 +58,7 @@ parameters may be used, like javac -verbose"
 	 (src-file (concat classname ".java"))
 	 (cmpflag (or (cdr (assq :cmpflag params)) ""))
 	 (cmdline (or (cdr (assq :cmdline params)) ""))
+	 (cmdargs (or (cdr (assq :cmdargs params)) ""))
 	 (full-body (org-babel-expand-body:generic body params)))
     (with-temp-file src-file (insert full-body))
     (org-babel-eval
@@ -66,7 +67,7 @@ parameters may be used, like javac -verbose"
     (unless (or (not packagename) (file-exists-p packagename))
       (make-directory packagename 'parents))
     (let ((results (org-babel-eval (concat org-babel-java-command
-                                           " " cmdline " " classname) "")))
+                                           " " cmdline " " classname " " cmdargs) "")))
       (org-babel-reassemble-table
        (org-babel-result-cond (cdr (assq :result-params params))
 	 (org-babel-read results)
-- 
2.21.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: news --]
[-- Type: text/x-patch, Size: 924 bytes --]

From 033f455399d0821d818ef6ff1c01036c04873ddb Mon Sep 17 00:00:00 2001
From: Jarmo Hurri <jarmo.hurri@iki.fi>
Date: Sun, 1 Dec 2019 12:26:55 +0200
Subject: [PATCH 2/2] Mention header argument to pass command arguments to Java
 blocks in ORG-NEWS

* etc/ORG-NEWS: Mention header argument :cmdargs for Java code blocks.
---
 etc/ORG-NEWS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 689a07871..ac3d1517f 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -19,6 +19,9 @@ just as if it was at outline level 0.  Inheritance for properties will
 work also for this level.  In other words; defining things in a
 property drawer before the first headline will make them "inheritable"
 for all headlines.
+*** New header argument to pass Java command line arguments
+Babel Java blocks recognize header argument =:cmdargs= and pass its
+value in call to =java=.
 
 * Version 9.3
 
-- 
2.21.0


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

* Re: [PATCH] ob-java.el: Add header argument to pass command line args
  2019-12-01 10:33     ` Jarmo Hurri
@ 2019-12-27  8:00       ` Jarmo Hurri
  2019-12-27  8:58         ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Jarmo Hurri @ 2019-12-27  8:00 UTC (permalink / raw)
  To: emacs-orgmode


Greetings.

I posted an updated version of the patch here on December 1st, but I
have not yet seen it in the master branch so far. Was the patch ok, or
do I still need to do something else than wait?

As a new year approaches, I too want to thank everyone involved in Org
for creating such a great tool. I use it for all my work currently.

All the best,

Jarmo

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

* Re: [PATCH] ob-java.el: Add header argument to pass command line args
  2019-12-27  8:00       ` Jarmo Hurri
@ 2019-12-27  8:58         ` Nicolas Goaziou
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2019-12-27  8:58 UTC (permalink / raw)
  To: Jarmo Hurri; +Cc: emacs-orgmode

Hello,

Jarmo Hurri <jarmo.hurri@iki.fi> writes:

> I posted an updated version of the patch here on December 1st, but I
> have not yet seen it in the master branch so far. Was the patch ok, or
> do I still need to do something else than wait?

It probably felt off the cracks, sorry about that.

I just applied it. Thank you!

Regards,

-- 
Nicolas Goaziou

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

* Re: [PATCH] ob-java.el: Add header argument to pass command line args
  2019-11-06 10:29 [PATCH] ob-java.el: Add header argument to pass command line args Jarmo Hurri
  2019-11-22  5:12 ` Jarmo Hurri
@ 2020-02-12 11:54 ` Bastien
  1 sibling, 0 replies; 7+ messages in thread
From: Bastien @ 2020-02-12 11:54 UTC (permalink / raw)
  To: Jarmo Hurri; +Cc: emacs-orgmode

Hi Jarmo,

Jarmo Hurri <jarmo.hurri@iki.fi> writes:

> ... attached

Just to confirm: this has been applied.

-- 
 Bastien

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

end of thread, other threads:[~2020-02-12 11:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 10:29 [PATCH] ob-java.el: Add header argument to pass command line args Jarmo Hurri
2019-11-22  5:12 ` Jarmo Hurri
2019-11-24  9:14   ` Nicolas Goaziou
2019-12-01 10:33     ` Jarmo Hurri
2019-12-27  8:00       ` Jarmo Hurri
2019-12-27  8:58         ` Nicolas Goaziou
2020-02-12 11:54 ` Bastien

Code repositories for project(s) associated with this 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).