emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* customizable C, C++, D, Java, Groovy compilers
@ 2014-06-15 13:35 Thierry Banel
  2014-06-16 15:05 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Thierry Banel @ 2014-06-15 13:35 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi all

Here is a patch to make compilers customizable
  (by typing M-x customize-group org-babel).
It applies to C, C++, D, Java, Groovy.
This is consistent with customizations for R, Python, Ditaa and others
languages.

Have fun
Thierry



[-- Attachment #2: 0001-Make-C-C-D-Java-Groovy-compilers-customizable.patch --]
[-- Type: text/x-diff, Size: 4146 bytes --]

From 933f50c3fbebefec14b5df8ebff0cebaf3e45922 Mon Sep 17 00:00:00 2001
From: Thierry Banel <tbanelwebmin@free.fr>
Date: Sun, 15 Jun 2014 14:53:34 +0200
Subject: [PATCH] 	Make C, C++, D, Java, Groovy compilers customizable

	* ob-C.el (org-babel-C-compiler):
	(org-babel-C++-compiler):
	(org-babel-D-compiler): changed defvar to defcustom
	* ob-java.el (org-babel-java-command):
	(org-babel-java-compiler): changed defvar to defcustom
	* ob-groovy.el (org-babel-groovy-command):
	changed defvar to defcustom
---
 lisp/ob-C.el      |   36 ++++++++++++++++++++++++++----------
 lisp/ob-groovy.el |   10 ++++++++--
 lisp/ob-java.el   |   22 +++++++++++++++++-----
 3 files changed, 51 insertions(+), 17 deletions(-)

diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index 505b290..2e146d4 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -46,16 +46,32 @@
 
 (defvar org-babel-default-header-args:C '())
 
-(defvar org-babel-C-compiler "gcc"
-  "Command used to compile a C source code file into an
-executable.")
-
-(defvar org-babel-C++-compiler "g++"
-  "Command used to compile a C++ source code file into an
-executable.")
-
-(defvar org-babel-D-compiler "rdmd"
-  "Command used to compile and execute a D source code file.")
+(defcustom org-babel-C-compiler "gcc"
+  "Command used to compile a C source code file into an executable.
+May be either a command in the path, like gcc
+or an absolute path name, like /usr/local/bin/gcc
+parameter may be used, like gcc -v"
+  :group 'org-babel
+  :version "24.3"
+  :type 'string)
+
+(defcustom org-babel-C++-compiler "g++"
+  "Command used to compile a C++ source code file into an executable.
+May be either a command in the path, like g++
+or an absolute path name, like /usr/local/bin/g++
+parameter may be used, like g++ -v"
+  :group 'org-babel
+  :version "24.3"
+  :type 'string)
+
+(defcustom org-babel-D-compiler "rdmd"
+  "Command used to compile and execute a D source code file.
+May be either a command in the path, like rdmd
+or an absolute path name, like /usr/local/bin/rdmd
+parameter may be used, like rdmd --chatty"
+  :group 'org-babel
+  :version "24.3"
+  :type 'string)
 
 (defvar org-babel-c-variant nil
   "Internal variable used to hold which type of C (e.g. C or C++ or D)
diff --git a/lisp/ob-groovy.el b/lisp/ob-groovy.el
index 9bb17e6..0068df9 100644
--- a/lisp/ob-groovy.el
+++ b/lisp/ob-groovy.el
@@ -36,8 +36,14 @@
 (defvar org-babel-tangle-lang-exts) ;; Autoloaded
 (add-to-list 'org-babel-tangle-lang-exts '("groovy" . "groovy"))
 (defvar org-babel-default-header-args:groovy '())
-(defvar org-babel-groovy-command "groovy"
-  "Name of the command to use for executing Groovy code.")
+(defcustom org-babel-groovy-command "groovy"
+  "Name of the command to use for executing Groovy code.
+May be either a command in the path, like groovy
+or an absolute path name, like /usr/local/bin/groovy
+parameters may be used, like groovy -v"
+  :group 'org-babel
+  :version "24.3"
+  :type 'string)
 
 (defun org-babel-execute:groovy (body params)
   "Execute a block of Groovy code with org-babel.  This function is
diff --git a/lisp/ob-java.el b/lisp/ob-java.el
index 22f8785..8c64171 100644
--- a/lisp/ob-java.el
+++ b/lisp/ob-java.el
@@ -32,11 +32,23 @@
 (defvar org-babel-tangle-lang-exts)
 (add-to-list 'org-babel-tangle-lang-exts '("java" . "java"))
 
-(defvar org-babel-java-command "java"
-  "Name of the java command.")
-
-(defvar org-babel-java-compiler "javac"
-  "Name of the java compiler.")
+(defcustom org-babel-java-command "java"
+  "Name of the java command.
+May be either a command in the path, like java
+or an absolute path name, like /usr/local/bin/java
+parameters may be used, like java -verbose"
+  :group 'org-babel
+  :version "24.3"
+  :type 'string)
+
+(defcustom org-babel-java-compiler "javac"
+  "Name of the java compiler.
+May be either a command in the path, like javac
+or an absolute path name, like /usr/local/bin/javac
+parameters may be used, like javac -verbose"
+  :group 'org-babel
+  :version "24.3"
+  :type 'string)
 
 (defun org-babel-execute:java (body params)
   (let* ((classname (or (cdr (assoc :classname params))
-- 
1.7.9.5


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

* Re: customizable C, C++, D, Java, Groovy compilers
  2014-06-15 13:35 customizable C, C++, D, Java, Groovy compilers Thierry Banel
@ 2014-06-16 15:05 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2014-06-16 15:05 UTC (permalink / raw)
  To: Thierry Banel; +Cc: emacs-orgmode

Applied, Thanks!

Thierry Banel <tbanelwebmin@free.fr> writes:

> Hi all
>
> Here is a patch to make compilers customizable
>   (by typing M-x customize-group org-babel).
> It applies to C, C++, D, Java, Groovy.
> This is consistent with customizations for R, Python, Ditaa and others
> languages.
>
> Have fun
> Thierry
>
>
>
> From 933f50c3fbebefec14b5df8ebff0cebaf3e45922 Mon Sep 17 00:00:00 2001
> From: Thierry Banel <tbanelwebmin@free.fr>
> Date: Sun, 15 Jun 2014 14:53:34 +0200
> Subject: [PATCH] 	Make C, C++, D, Java, Groovy compilers customizable
>
> 	* ob-C.el (org-babel-C-compiler):
> 	(org-babel-C++-compiler):
> 	(org-babel-D-compiler): changed defvar to defcustom
> 	* ob-java.el (org-babel-java-command):
> 	(org-babel-java-compiler): changed defvar to defcustom
> 	* ob-groovy.el (org-babel-groovy-command):
> 	changed defvar to defcustom
> ---
>  lisp/ob-C.el      |   36 ++++++++++++++++++++++++++----------
>  lisp/ob-groovy.el |   10 ++++++++--
>  lisp/ob-java.el   |   22 +++++++++++++++++-----
>  3 files changed, 51 insertions(+), 17 deletions(-)
>
> diff --git a/lisp/ob-C.el b/lisp/ob-C.el
> index 505b290..2e146d4 100644
> --- a/lisp/ob-C.el
> +++ b/lisp/ob-C.el
> @@ -46,16 +46,32 @@
>  
>  (defvar org-babel-default-header-args:C '())
>  
> -(defvar org-babel-C-compiler "gcc"
> -  "Command used to compile a C source code file into an
> -executable.")
> -
> -(defvar org-babel-C++-compiler "g++"
> -  "Command used to compile a C++ source code file into an
> -executable.")
> -
> -(defvar org-babel-D-compiler "rdmd"
> -  "Command used to compile and execute a D source code file.")
> +(defcustom org-babel-C-compiler "gcc"
> +  "Command used to compile a C source code file into an executable.
> +May be either a command in the path, like gcc
> +or an absolute path name, like /usr/local/bin/gcc
> +parameter may be used, like gcc -v"
> +  :group 'org-babel
> +  :version "24.3"
> +  :type 'string)
> +
> +(defcustom org-babel-C++-compiler "g++"
> +  "Command used to compile a C++ source code file into an executable.
> +May be either a command in the path, like g++
> +or an absolute path name, like /usr/local/bin/g++
> +parameter may be used, like g++ -v"
> +  :group 'org-babel
> +  :version "24.3"
> +  :type 'string)
> +
> +(defcustom org-babel-D-compiler "rdmd"
> +  "Command used to compile and execute a D source code file.
> +May be either a command in the path, like rdmd
> +or an absolute path name, like /usr/local/bin/rdmd
> +parameter may be used, like rdmd --chatty"
> +  :group 'org-babel
> +  :version "24.3"
> +  :type 'string)
>  
>  (defvar org-babel-c-variant nil
>    "Internal variable used to hold which type of C (e.g. C or C++ or D)
> diff --git a/lisp/ob-groovy.el b/lisp/ob-groovy.el
> index 9bb17e6..0068df9 100644
> --- a/lisp/ob-groovy.el
> +++ b/lisp/ob-groovy.el
> @@ -36,8 +36,14 @@
>  (defvar org-babel-tangle-lang-exts) ;; Autoloaded
>  (add-to-list 'org-babel-tangle-lang-exts '("groovy" . "groovy"))
>  (defvar org-babel-default-header-args:groovy '())
> -(defvar org-babel-groovy-command "groovy"
> -  "Name of the command to use for executing Groovy code.")
> +(defcustom org-babel-groovy-command "groovy"
> +  "Name of the command to use for executing Groovy code.
> +May be either a command in the path, like groovy
> +or an absolute path name, like /usr/local/bin/groovy
> +parameters may be used, like groovy -v"
> +  :group 'org-babel
> +  :version "24.3"
> +  :type 'string)
>  
>  (defun org-babel-execute:groovy (body params)
>    "Execute a block of Groovy code with org-babel.  This function is
> diff --git a/lisp/ob-java.el b/lisp/ob-java.el
> index 22f8785..8c64171 100644
> --- a/lisp/ob-java.el
> +++ b/lisp/ob-java.el
> @@ -32,11 +32,23 @@
>  (defvar org-babel-tangle-lang-exts)
>  (add-to-list 'org-babel-tangle-lang-exts '("java" . "java"))
>  
> -(defvar org-babel-java-command "java"
> -  "Name of the java command.")
> -
> -(defvar org-babel-java-compiler "javac"
> -  "Name of the java compiler.")
> +(defcustom org-babel-java-command "java"
> +  "Name of the java command.
> +May be either a command in the path, like java
> +or an absolute path name, like /usr/local/bin/java
> +parameters may be used, like java -verbose"
> +  :group 'org-babel
> +  :version "24.3"
> +  :type 'string)
> +
> +(defcustom org-babel-java-compiler "javac"
> +  "Name of the java compiler.
> +May be either a command in the path, like javac
> +or an absolute path name, like /usr/local/bin/javac
> +parameters may be used, like javac -verbose"
> +  :group 'org-babel
> +  :version "24.3"
> +  :type 'string)
>  
>  (defun org-babel-execute:java (body params)
>    (let* ((classname (or (cdr (assoc :classname params))

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)

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

end of thread, other threads:[~2014-06-16 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-15 13:35 customizable C, C++, D, Java, Groovy compilers Thierry Banel
2014-06-16 15:05 ` 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).