emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] org-exp-block patch and Graphviz Demo


From: Eric Schulte
Subject: Re: [Orgmode] org-exp-block patch and Graphviz Demo
Date: Thu, 28 May 2009 07:23:35 -0700
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.92 (darwin)

"Eric Schulte" <address@hidden> writes:

> Carsten Dominik <address@hidden> writes:
>
>> On May 27, 2009, at 9:09 PM, Russell Adams wrote:
>>
[...]
>
> Hi Russel,
>
> Thanks for the update, and for the clear exposition in the org demo
> file.  I think that rather than changing the specification of the dot
> block (which will break existing org files) we should create new block
> files.  Either create a single graphviz file, which will accept an
> argument indicating which command to use, or create a new block type for
> each command.  I'm not sure which of these approaches would be
> preferred...  They should both require only small changes to your
> existing code.  If we were starting from scratch my preference would be
> a single graphviz block type, however in order to maintain functionality
> for existing org-mode documents, in this case I would lean towards
> generating a block type for each command.  I suppose we could support
> both options.
>

The attached version of org-exp-blocks.el should support both graphviz
blocks (accepting each command as the first header argument), as well as
block types for all of the commands (see the monolithic mapc statement).

> 
> If our goal is just to allow post processing in this instance, I
> believe that using defadvice would be the easiest hack.  Make sure
> that the last statement in `org-export-blocks-format-dot' returns the
> file path, and then try something like the following...
>
> (defadvice org-export-blocks-format-dot (around 
> fix-eps-org-export-blocks-format-dot activate)
>   "Fix graphviz eps output."
>   (let ((file ad-do-it))
>     (shell-command (format "sed -i -e 's/PS-Adobe-2.0/PS-Adobe-2.0 
> EPSF-1.2/1' %s" file))))
>

I was mistaken about the return value of org-export-blocks-format-dot,
perhaps a defadvice more like the following would be preferable.

;; untested
(defadvice org-export-blocks-format-dot (around 
fix-eps-org-export-blocks-format-dot activate)
  "Fix graphviz eps output."
  (let ((out-file (if headers (car headers))))
    ad-do-it
    (if (string-match "\\.eps" out-file)
        (shell-command (format "sed -i -e 's/PS-Adobe-2.0/PS-Adobe-2.0 
EPSF-1.2/1' %s" out-file)))))

-- Eric

Attachment: org-exp-blocks.el
Description: application/emacs-lisp


reply via email to

[Prev in Thread] Current Thread [Next in Thread]