From d3a45bd7221578e9e3f4ca08b8ee9d0d1a5e9bbc Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 4 Jan 2012 11:22:28 +0100 Subject: [PATCH] ob-ditaa.el: New option `org-ditaa-jar-option'. * ob-ditaa.el (org-ditaa-jar-path): Make a defcustom. (org-ditaa-jar-option): New option. (org-babel-execute:ditaa): Use it. Thanks to Waldemar Reusch for reporting this need. --- lisp/ob-ditaa.el | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el index 57ae4b947..17e9d5d0c 100644 --- a/lisp/ob-ditaa.el +++ b/lisp/ob-ditaa.el @@ -39,10 +39,22 @@ (require 'ob) (defvar org-babel-default-header-args:ditaa - '((:results . "file") (:exports . "results") (:java . "-Dfile.encoding=UTF-8")) + '((:results . "file") + (:exports . "results") + (:java . "-Dfile.encoding=UTF-8")) "Default arguments for evaluating a ditaa source block.") -(defvar org-ditaa-jar-path) +(defcustom org-ditaa-jar-path nil + "Path for the ditaa jar file." + :group 'org-babel + :type 'string) + +(defcustom org-ditaa-jar-option "-jar" + "Option for the ditaa jar file. +Do not leave leading or trailing spaces in this string." + :group 'org-babel + :type 'string) + (defun org-babel-execute:ditaa (body params) "Execute a block of Ditaa code with org-babel. This function is called by `org-babel-execute-src-block'." @@ -55,7 +67,7 @@ This function is called by `org-babel-execute-src-block'." (cmdline (cdr (assoc :cmdline params))) (java (cdr (assoc :java params))) (in-file (org-babel-temp-file "ditaa-")) - (cmd (concat "java " java " -jar " + (cmd (concat "java " java " " org-ditaa-jar-option " " (shell-quote-argument (expand-file-name org-ditaa-jar-path)) " " cmdline