From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Bug: ob-ditaa fails in generating pdf correctly Date: Fri, 06 Jun 2014 12:22:48 -0400 Message-ID: <87iooeezar.fsf@gmail.com> References: <537E177E.9010906@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wsxig-0007jf-J6 for emacs-orgmode@gnu.org; Fri, 06 Jun 2014 13:14:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wsxib-0002Pw-RJ for emacs-orgmode@gnu.org; Fri, 06 Jun 2014 13:14:22 -0400 Received: from mail-qa0-x22a.google.com ([2607:f8b0:400d:c00::22a]:35383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wsxib-0002Pk-N6 for emacs-orgmode@gnu.org; Fri, 06 Jun 2014 13:14:17 -0400 Received: by mail-qa0-f42.google.com with SMTP id j5so4378478qaq.1 for ; Fri, 06 Jun 2014 10:14:17 -0700 (PDT) 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: Anders Johansson Cc: emacs-orgmode@gnu.org Anders Johansson writes: > Hi, > Example input: > #+header: :eps t > #+header: :file hello.pdf > #+BEGIN_SRC ditaa > +--------------+ > | | > | Hello | > | | > +--------------+ > #+END_SRC > > > When using the above code (which I guessed should be the correct way) > with ob-ditaa to produce a pdf (through DitaaEps -> epstopdf) it fails > in producing the pdf correctly and instead writes an eps to "hello.pdf". > This isn't surprising, looking at the code where "cmd" should be > constructed to produce the eps as an intermediary file in /tmp (which is > expected in the construction of pdf-cmd) but doesn't. > > An ugly patch to fix it is attached Applied. > (this is ugly because it repeats the line: > (org-babel-process-file-name (concat in-file ".eps")) ) > I un-duplicated this line. Thanks, > > Cheers, > Anders Johansson > > --- "/home/aj/H\303\244mtningar/ob-ditaa.el" 2014-05-22 17:15:35.489071991 +0200 > +++ ob-ditaa.el 2014-05-22 17:08:46.617089186 +0200 > @@ -90,6 +90,12 @@ > (java (cdr (assoc :java params))) > (in-file (org-babel-temp-file "ditaa-")) > (eps (cdr (assoc :eps params))) > + (pdf-cmd (when (and (or (string= (file-name-extension out-file) "pdf") > + (cdr (assoc :pdf params)))) > + (concat > + "epstopdf" > + " " (org-babel-process-file-name (concat in-file ".eps")) > + " -o=" (org-babel-process-file-name out-file)))) > (cmd (concat org-babel-ditaa-java-cmd > " " java " " org-ditaa-jar-option " " > (shell-quote-argument > @@ -97,13 +103,10 @@ > (if eps org-ditaa-eps-jar-path org-ditaa-jar-path))) > " " cmdline > " " (org-babel-process-file-name in-file) > - " " (org-babel-process-file-name out-file))) > - (pdf-cmd (when (and (or (string= (file-name-extension out-file) "pdf") > - (cdr (assoc :pdf params)))) > - (concat > - "epstopdf" > - " " (org-babel-process-file-name (concat in-file ".eps")) > - " -o=" (org-babel-process-file-name out-file))))) > + " " (if pdf-cmd > + (org-babel-process-file-name (concat in-file ".eps")) > + (org-babel-process-file-name out-file)))) > + ) > (unless (file-exists-p org-ditaa-jar-path) > (error "Could not find ditaa.jar at %s" org-ditaa-jar-path)) > (with-temp-file in-file (insert body)) -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D (see https://u.fsf.org/yw)