From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Vladimir Alexiev" Subject: How to define file-local preamble for graphviz dot? Date: Fri, 1 Aug 2014 19:28:01 +0300 Message-ID: <11526.9980895848$1406910543@news.gmane.org> Reply-To: vladimir.alexiev@ontotext.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDFgp-0002QV-FE for emacs-orgmode@gnu.org; Fri, 01 Aug 2014 12:28:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XDFgh-0005EP-SH for emacs-orgmode@gnu.org; Fri, 01 Aug 2014 12:28:19 -0400 Received: from mail.ontotext.com ([93.123.21.89]:51196 helo=ontomail.ontotext.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDFgh-00059j-L7 for emacs-orgmode@gnu.org; Fri, 01 Aug 2014 12:28:11 -0400 Received: from localhost (localhost [127.0.0.1]) by ontomail.ontotext.com (Postfix) with ESMTP id A9B752EBB1 for ; Fri, 1 Aug 2014 19:27:59 +0300 (EEST) Received: from ontomail.ontotext.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RYEnczIMcGny for ; Fri, 1 Aug 2014 19:27:59 +0300 (EEST) Received: from vladoa (client-93-123-21-124.ip.daticum.com [93.123.21.124]) by ontomail.ontotext.com (Postfix) with ESMTPSA id 47DAC2EBAC for ; Fri, 1 Aug 2014 19:27:59 +0300 (EEST) Content-Language: en-us 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org I have a bunch of dot settings that I want to set globally. I hacked it like this: (setq va/org-dot-preamble "digraph g { rankdir=LR nodesep=0.2 ranksep=0.1 arrowsize=0.2 node [fontname=courier fontsize=10 margin=\"0.02,0.01\" shape=box width=0.1 height=0.1] edge [fontname=courier fontsize=8 labelfontname=courier labelfontsize=8]") (defadvice org-babel-expand-body:dot (before add-preamble (body params) activate) "add DOT=va/org-dot-preamble as :var in params, so $dot is replaced with it" (setq params (cons (cons ':var (cons 'DOT va/org-dot-preamble)) params))) And then I start dot code blocks with "$dot", which is replaced with the above string: #+begin_src dot :results silent file :file ./img/SymmetricProperty.png $dot x -> y [label="q"] y -> x [label="q" color=red] } #+end_src I can override a dot param by adding a different value after the common inclusion $dot, e.g.: $dot ranksep=0.7 The problem is *** how can I make this per-file? Neither #+BIND nor emacs "Local Variables:" does the trick. Bonus if I can do it per-heading :-) dot can take these settings from the command line, eg -G "rankdir=LR nodesep=0.2 ranksep=0.1 arrowsize=0.2" -N "fontname=courier fontsize=10 margin=\"0.02,0.01\" shape=box width=0.1 height=0.1" -E "fontname=courier fontsize=8 labelfontname=courier labelfontsize=8" So I could try to mess with the :cmdline slot of org-babel-default-header-args:dot ... is this evaluated locally?