From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thibault Marin Subject: Re: Add preamble support to ob-plantuml.el Date: Mon, 05 Dec 2016 21:52:37 -0600 Message-ID: <87h96hpvcq.fsf@dell-desktop.WORKGROUP> References: <87bmwu29yk.fsf@dell-desktop.WORKGROUP> <87shq29ib5.fsf@nicolasgoaziou.fr> Reply-To: thibault.marin@gmx.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cE6oB-0002Dt-HS for emacs-orgmode@gnu.org; Mon, 05 Dec 2016 22:52:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cE6o8-0006bd-Bx for emacs-orgmode@gnu.org; Mon, 05 Dec 2016 22:52:47 -0500 Received: from mout.gmx.net ([212.227.17.21]:56215) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cE6o8-0006bH-12 for emacs-orgmode@gnu.org; Mon, 05 Dec 2016 22:52:44 -0500 In-reply-to: <87shq29ib5.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: emacs-orgmode --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ob-plantuml.el-Add-preamble-to-PlantUML-source-block.patch >From 55edfde3636a9e558fe6ca1099477611a2f3ed0f Mon Sep 17 00:00:00 2001 From: thibault 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 --=-=-=--