From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cDOEBQICcV+/GQAA0tVLHw (envelope-from ) for ; Sun, 27 Sep 2020 21:20:02 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id qLBVAQICcV9sUQAAbx9fmQ (envelope-from ) for ; Sun, 27 Sep 2020 21:20:02 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BA04B9401D0 for ; Sun, 27 Sep 2020 21:20:01 +0000 (UTC) Received: from localhost ([::1]:39008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMe5P-0005fa-Sx for larch@yhetil.org; Sun, 27 Sep 2020 17:19:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMe54-0005fT-HN for emacs-orgmode@gnu.org; Sun, 27 Sep 2020 17:19:38 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]:44211) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kMe52-0002ST-R7 for emacs-orgmode@gnu.org; Sun, 27 Sep 2020 17:19:38 -0400 Received: by mail-lj1-x22d.google.com with SMTP id b19so6675497lji.11 for ; Sun, 27 Sep 2020 14:19:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=user-agent:from:to:cc:subject:message-id:date:mime-version; bh=+5kqYzWyiNiqySht8cT2JSOLJz+OlIoDAjVaU1eq8rk=; b=oUyNE2uf3qnpzeki5P+kniX8gIgynmcnCyqNxM9OOlK05M2U2Hmi5sdyCLGt7yb8pl 8oBLXYK92JRIFXg08dBgzAeAO723fqYjq5D+pM51rn9X8YTSL1ycU3K1LBl4nqwal31w 9J7HhpF48yj1xAdbaUse/zlNOziW0SIkSmTK+Y/wFgX+9UGgbZCbbeSvJJsheUC71h6b AXFgqLUJNtVrHacWjZYlF2zVl7vOwk+DZjycLq85a/qBlH//EiDPNYlBz52lD/UJXJe8 hI/K//Yz+VXZHsy5+xyG+XsMJostZChH2hcd9QlR7p9Ol09rvtRSGRpxqx5M4YjNZrQs Co8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:cc:subject:message-id:date :mime-version; bh=+5kqYzWyiNiqySht8cT2JSOLJz+OlIoDAjVaU1eq8rk=; b=M7y6FPqdtx8rLYOrLCh1ycuF2eoYmaVnvOPTE9jTm97XlNpqA2rMxoFzlSDAEBjDi2 +NCofHzmlfp71pEUyI99Az+ht3VezKUAzahT7sZMOGdPDW9vv9uxpzJg0UVg4p3loWoM z4uGspf8NvVBv4r+XtblzSxFLXB2XVzq50//AxG31paFYTXIekRK/1pYCMkUS7VCtpxm 3IbeH9j9UQVp8CLk6Dd78DnIVykeZhJ2rPbQ/SZaC8k5SGQN9hcmKeV+ZPdICe5deGBh DSZCH5sxFWODy1awGgCvAEy3eAXHmAeQqCEQfXcNT7dRqJdVlLGEu/LI4HoMGaOMPLTs 4sXw== X-Gm-Message-State: AOAM5337fmC3Mtjr9ZreupiwzzA7V2+x3sPO2Jng8WrI51R9u2dIgSkx /Q/vhNcjhdKnKee9FCF0XoviszPmQcc= X-Google-Smtp-Source: ABdhPJx15uRBCsLNTUvCkGCqO1chgWDKGB6Rw0anycGxTAi4B3E31EZp7xeLLHGWnmoFJkuilHUd6w== X-Received: by 2002:a2e:9457:: with SMTP id o23mr3794150ljh.71.1601241573963; Sun, 27 Sep 2020 14:19:33 -0700 (PDT) Received: from arch ([98.128.186.114]) by smtp.gmail.com with ESMTPSA id e14sm5695969ljp.15.2020.09.27.14.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2020 14:19:32 -0700 (PDT) User-agent: mu4e 1.4.10; emacs 27.1 From: John Herrlin To: ian martins Subject: ob-java compile only Message-ID: <87imbyapel.fsf@gmail.com> Date: Sun, 27 Sep 2020 23:19:31 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=jherrlin@gmail.com; helo=mail-lj1-x22d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org-Mode mailing list Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=oUyNE2uf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 2.29 X-TUID: sID95A3Lr9H2 --=-=-= Content-Type: text/plain Hey Ian! Happy to see you as the maintainer of the ob-java! I would like to propose a feature to ob-java. The feature allows a source code block to write and compile only, without executing. Here is a common use case for me. Class without a entry point have an :compile-only header. #+HEADER: :classname se/my_test_package/Hey #+HEADER: :dir src #+HEADER: :compile-only t #+HEADER: :results none #+BEGIN_SRC java package se.my_test_package; public class Hey { public static String hey(String name) { return "Hey " + name; } } #+END_SRC The provided diff works for my small use case. What do you think? -- Best regards John --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=ob-java-compile-only-header.diff diff --git a/lisp/ob-java.el b/lisp/ob-java.el index fee695bb9..5c98a0417 100644 --- a/lisp/ob-java.el +++ b/lisp/ob-java.el @@ -60,6 +60,7 @@ parameters may be used, like javac -verbose" (cmpflag (or (cdr (assq :cmpflag params)) "")) (cmdline (or (cdr (assq :cmdline params)) "")) (cmdargs (or (cdr (assq :cmdargs params)) "")) + (compile-only (assq :compile-only params)) (full-body (org-babel-expand-body:generic body params))) ;; created package-name directories if missing (unless (or (not packagename) (file-exists-p packagename)) @@ -67,18 +68,19 @@ parameters may be used, like javac -verbose" (with-temp-file src-file (insert full-body)) (org-babel-eval (concat org-babel-java-compiler " " cmpflag " " src-file) "") - (let ((results (org-babel-eval (concat org-babel-java-command - " " cmdline " " classname " " cmdargs) ""))) - (org-babel-reassemble-table - (org-babel-result-cond (cdr (assq :result-params params)) - (org-babel-read results t) - (let ((tmp-file (org-babel-temp-file "c-"))) - (with-temp-file tmp-file (insert results)) - (org-babel-import-elisp-from-file tmp-file))) - (org-babel-pick-name - (cdr (assq :colname-names params)) (cdr (assq :colnames params))) - (org-babel-pick-name - (cdr (assq :rowname-names params)) (cdr (assq :rownames params))))))) + (unless compile-only + (let ((results (org-babel-eval (concat org-babel-java-command + " " cmdline " " classname " " cmdargs) ""))) + (org-babel-reassemble-table + (org-babel-result-cond (cdr (assq :result-params params)) + (org-babel-read results t) + (let ((tmp-file (org-babel-temp-file "c-"))) + (with-temp-file tmp-file (insert results)) + (org-babel-import-elisp-from-file tmp-file))) + (org-babel-pick-name + (cdr (assq :colname-names params)) (cdr (assq :colnames params))) + (org-babel-pick-name + (cdr (assq :rowname-names params)) (cdr (assq :rownames params)))))))) (provide 'ob-java) --=-=-=--