emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Add preamble support to ob-plantuml.el
@ 2016-12-02  5:09 Thibault Marin
  2016-12-05 21:28 ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Thibault Marin @ 2016-12-02  5:09 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]


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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-plantuml.el-Add-preamble-to-PlantUML-source-block.patch --]
[-- Type: text/x-diff, Size: 1543 bytes --]

From 157181893c212fea29986c8b072d4f087e4ace24 Mon Sep 17 00:00:00 2001
From: thibault <thibault.marin@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.

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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-12-10 16:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02  5:09 Add preamble support to ob-plantuml.el Thibault Marin
2016-12-05 21:28 ` Nicolas Goaziou
2016-12-06  3:52   ` Thibault Marin
2016-12-06 11:42     ` Nicolas Goaziou
2016-12-06 12:14       ` Rainer M Krug
2016-12-07  1:39         ` Thibault Marin
2016-12-09 20:55           ` Nicolas Goaziou
2016-12-10  4:48             ` Thibault Marin
2016-12-10 11:08               ` Nicolas Goaziou
2016-12-10 14:35                 ` Thibault Marin
2016-12-10 16:05                   ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).