emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Rudolf Adamkovič" <salutis@me.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] ob-java: Define the list of all supported header arguments
Date: Thu, 20 Oct 2022 22:15:21 +0200	[thread overview]
Message-ID: <m2y1ta9rqe.fsf@me.com> (raw)

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

Hello smart folks!

The Org linter warns about *correct* Java source block arguments.  The
attached patch fixes that.

P.S. I originally had two regression tests, not one.  The other test
checked the '#+property:' version, e.g.

#+property: header-args:java+ :dir /tmp
#+property: header-args:java+ :classname com.example.Example
#+property: header-args:java+ :imports com.example.OtherExample
#+property: header-args:java+ :cmpflag -classpath .:/tmp/example/
#+property: header-args:java+ :cmdline -classpath .:/tmp/example/
#+property: header-args:java+ :cmdarg -verbose

However, the linter rejects these as unknown header arguments.  From
what I understand, that look like a separate issue.

Rudy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-java-Define-the-list-of-all-supported-header-argu.patch --]
[-- Type: text/x-patch, Size: 2128 bytes --]

From 54f008cdfcf4680b3d3bc7107aa640596d5a91bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
Date: Thu, 20 Oct 2022 21:31:37 +0200
Subject: [PATCH] ob-java: Define the list of all supported header arguments

* lisp/ob-java.el (org-babel-header-args:java): Complete the list of
header arguments supported for Java source blocks.
* testing/lisp/test-ob-java.el (ob-java/lint-header-arguments): Test
that the linter approves of all the supported arguments.
---
 lisp/ob-java.el              |  8 +++++++-
 testing/lisp/test-ob-java.el | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-java.el b/lisp/ob-java.el
index 832214f5c..395dbd20d 100644
--- a/lisp/ob-java.el
+++ b/lisp/ob-java.el
@@ -53,7 +53,13 @@ directory, so we keep that as the default behavior.
 
 [1] https://orgmode.org/manual/Results-of-Evaluation.html")
 
-(defconst org-babel-header-args:java '((imports . :any))
+(defconst org-babel-header-args:java
+  '((dir       . :any)
+    (classname . :any)
+    (imports   . :any)
+    (cmpflag   . :any)
+    (cmdline   . :any)
+    (cmdarg    . :any))
   "Java-specific header arguments.")
 
 (defcustom org-babel-java-command "java"
diff --git a/testing/lisp/test-ob-java.el b/testing/lisp/test-ob-java.el
index 215f1cb51..a62d66557 100644
--- a/testing/lisp/test-ob-java.el
+++ b/testing/lisp/test-ob-java.el
@@ -21,9 +21,26 @@
 ;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Code:
+
 (require 'org-test "../testing/org-test")
 (require 'ob-core)
 
+;;; No Java required
+
+(ert-deftest ob-java/lint-header-arguments ()
+  (org-test-with-temp-text "
+#+header: :dir /tmp
+#+header: :classname com.example.Example
+#+header: :imports com.example.OtherExample
+#+header: :cmpflag -classpath .:/tmp/example/
+#+header: :cmdline -classpath .:/tmp/example/
+#+header: :cmdarg -verbose
+#+begin_src java
+#+end_src"
+    (should-not (org-lint '(wrong-header-argument)))))
+
+;;; Java required
+
 (org-test-for-executable "java")
 (org-test-for-executable "javac")
 (unless (featurep 'ob-java)
-- 
2.38.0


[-- Attachment #3: Type: text/plain, Size: 208 bytes --]

-- 
"The whole science is nothing more than a refinement of everyday
thinking."
-- Albert Einstein, 1879-1955

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia

             reply	other threads:[~2022-10-20 20:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 20:15 Rudolf Adamkovič [this message]
2022-10-21  4:02 ` [PATCH] ob-java: Define the list of all supported header arguments Ihor Radchenko
2022-10-21 12:58   ` Rudolf Adamkovič
2022-10-21 13:02     ` Rudolf Adamkovič
2022-10-21 14:00       ` Ihor Radchenko
2022-11-08 11:50       ` Max Nikulin
2022-11-08 12:41         ` Ihor Radchenko
2022-11-09  0:30         ` Rudolf Adamkovič
2022-11-09  2:19           ` Ihor Radchenko
2022-11-10  0:05             ` Rudolf Adamkovič
2022-11-10  2:12               ` Ihor Radchenko
2022-11-10  8:26                 ` Bruno Barbier
2022-11-10  8:59                   ` Ihor Radchenko
2022-11-10 19:07                     ` Bruno Barbier
2022-11-11 23:13                 ` Rudolf Adamkovič
2022-11-12 13:01                   ` Ihor Radchenko
2022-11-12 22:05                     ` Rudolf Adamkovič
2022-11-13  4:41                       ` Ihor Radchenko

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=m2y1ta9rqe.fsf@me.com \
    --to=salutis@me.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).