From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarmo Hurri Subject: Re: [PATCH] ob-java.el: Add header argument to pass command line args Date: Sun, 01 Dec 2019 12:33:33 +0200 Message-ID: <87sgm472te.fsf@iki.fi> References: <8736f18fh6.fsf@iki.fi> <87lfs88pfg.fsf@iki.fi> <87o8x14ovr.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:32850) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibMXz-0001h7-E3 for emacs-orgmode@gnu.org; Sun, 01 Dec 2019 05:33:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibMXx-0007ET-Sp for emacs-orgmode@gnu.org; Sun, 01 Dec 2019 05:33:47 -0500 Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226]:59574 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ibMXx-0007ED-Ix for emacs-orgmode@gnu.org; Sun, 01 Dec 2019 05:33:45 -0500 Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1ibMXt-0001sO-ET for emacs-orgmode@gnu.org; Sun, 01 Dec 2019 11:33:41 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Nicolas Goaziou 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ob-java.el-Add-header-argument-to-pass-command-line-.patch Content-Description: babel >From 5089053f4f3f916dfbdab009d28b16ffac6f9055 Mon Sep 17 00:00:00 2001 From: Jarmo Hurri 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Mention-header-argument-to-pass-command-arguments-to.patch Content-Description: news >From 033f455399d0821d818ef6ff1c01036c04873ddb Mon Sep 17 00:00:00 2001 From: Jarmo Hurri 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 --=-=-=--