emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thibault Marin <thibault.marin@gmx.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Add preamble support to ob-plantuml.el
Date: Mon, 05 Dec 2016 21:52:37 -0600	[thread overview]
Message-ID: <87h96hpvcq.fsf@dell-desktop.WORKGROUP> (raw)
In-Reply-To: <87shq29ib5.fsf@nicolasgoaziou.fr>

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


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



[-- 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: 1589 bytes --]

From 55edfde3636a9e558fe6ca1099477611a2f3ed0f Mon Sep 17 00:00:00 2001
From: thibault <thibault.marin@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	other threads:[~2016-12-06  3:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h96hpvcq.fsf@dell-desktop.WORKGROUP \
    --to=thibault.marin@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).