Hi list,

I am attaching a patch adding support for preamble commands to
ob-plantuml.el.  The string content of the `org-plantuml-preamble'
variable is added at the beginning of each source block before execution
(after the "@startuml" string).

Does this look like this could be merged?  Please let me know if the
patch needs changes.



>From 157181893c212fea29986c8b072d4f087e4ace24 Mon Sep 17 00:00:00 2001
From: thibault <thibault.ma...@gmx.com>
Date: Thu, 1 Dec 2016 22:50:32 -0600
Subject: [PATCH] ob-plantuml.el: Add preamble to PlantUML source block

* lisp/ob-plantuml.el (org-babel-execute:plantuml) Include preamble
  given by the new `org-plantuml-preamble' customization variable.

 lisp/ob-plantuml.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el
index 9ce65a9..6463585 100644
--- a/lisp/ob-plantuml.el
+++ b/lisp/ob-plantuml.el
@@ -46,6 +46,12 @@
   :version "24.1"
   :type 'string)
+(defcustom org-plantuml-preamble ""
+  "Preamble added at the top of every plantuml source block."
+  :group 'org-babel
+  :version "24.1"
+  :type 'string)
 (defun org-babel-execute:plantuml (body params)
   "Execute a block of plantuml code with org-babel.
 This function is called by `org-babel-execute-src-block'."
@@ -85,7 +91,8 @@ This function is called by `org-babel-execute-src-block'."
 			(org-babel-process-file-name out-file)))))
     (unless (file-exists-p org-plantuml-jar-path)
       (error "Could not find plantuml.jar at %s" org-plantuml-jar-path))
-    (with-temp-file in-file (insert (concat "@startuml\n" body "\n@enduml")))
+    (with-temp-file in-file (insert (concat "@startuml\n" org-plantuml-preamble
+					    "\n" body "\n@enduml")))
     (message "%s" cmd) (org-babel-eval cmd "")
     nil)) ;; signal that output has already been written to file

Reply via email to