From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thibault Marin Subject: Add preamble support to ob-plantuml.el Date: Thu, 01 Dec 2016 23:09:39 -0600 Message-ID: <87bmwu29yk.fsf@dell-desktop.WORKGROUP> 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]:47185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCg6Z-0001Oe-CT for emacs-orgmode@gnu.org; Fri, 02 Dec 2016 00:09:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cCg6U-0000cX-DU for emacs-orgmode@gnu.org; Fri, 02 Dec 2016 00:09:51 -0500 Received: from mout.gmx.net ([212.227.17.22]:55955) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cCg6U-0000bm-3W for emacs-orgmode@gnu.org; Fri, 02 Dec 2016 00:09:46 -0500 Received: from dell-desktop ([99.47.196.62]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0LkTSx-1coUpR2aKp-00cNzB for ; Fri, 02 Dec 2016 06:09:42 +0100 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: emacs-orgmode --=-=-= Content-Type: text/plain 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. Thanks, thibault --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ob-plantuml.el-Add-preamble-to-PlantUML-source-block.patch >From 157181893c212fea29986c8b072d4f087e4ace24 Mon Sep 17 00:00:00 2001 From: thibault 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. TINYCHANGE --- 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 -- 2.9.3 --=-=-=--