Hi, thanks for the feedback.

> You don't need to use the TINYCHANGE string since you signed FSF papers
> already.
Fixed.

> The :version keyword is inaccurate. It should be :version "25.2". It is
> also missing :package-version and :safe #'stringp.
Fixed (I hope).

> OOC, what is your use case?
I use it to define common skin options (http://plantuml.com/skinparam)
for all the plantuml blocks in an org file.  I don't know if there is a
better way to that.

Thanks,

thibault


>From 55edfde3636a9e558fe6ca1099477611a2f3ed0f Mon Sep 17 00:00:00 2001
From: thibault <thibault.ma...@gmx.com>
Date: Mon, 5 Dec 2016 15:46:46 -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 | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el
index 9ce65a9..d73a04b 100644
--- a/lisp/ob-plantuml.el
+++ b/lisp/ob-plantuml.el
@@ -46,6 +46,14 @@
   :version "24.1"
   :type 'string)
 
+(defcustom org-plantuml-preamble ""
+  "Preamble added at the top of every plantuml source block."
+  :group 'org-babel
+  :version "25.2"
+  :package-version '(Org . "9.1")
+  :safe #'stringp
+  :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 +93,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
 
-- 
2.9.3

Reply via email to