all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Problem with ditaa when doing export from command line
@ 2011-06-10  7:33 Herbert Sitz
  2011-06-10  7:52 ` Carsten Dominik
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Sitz @ 2011-06-10  7:33 UTC (permalink / raw)
  To: emacs-orgmode

I'm trying to do an export by calling emacs from the command line like so:

emacs -batch --visit=myfilename --funcall org-export-as-html

The export works fine except the ditaa png from ditaa source block doesn't get
created.

I've run the export from within emacs and the ditaa png does get created.  The
export also stops to present me with dialog asking whether I want to process the
ditaa code, to which I respond Yes.  I don't get any dialog when I do the export
from the command line.

Is there some way to get the ditaa code working when I do the export from the
command line.

I'm running this on Windows7 if that makes any difference.

Thanks,

Herb

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

* Re: Problem with ditaa when doing export from command line
  2011-06-10  7:33 Problem with ditaa when doing export from command line Herbert Sitz
@ 2011-06-10  7:52 ` Carsten Dominik
  2011-06-10 15:47   ` Herbert Sitz
  0 siblings, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2011-06-10  7:52 UTC (permalink / raw)
  To: Herbert Sitz; +Cc: emacs-orgmode

Hi Herbert,

On Jun 10, 2011, at 9:33 AM, Herbert Sitz wrote:

> I'm trying to do an export by calling emacs from the command line like so:
> 
> emacs -batch --visit=myfilename --funcall org-export-as-html

maybe you need to do

emacs -batch --visit=myfilename --eval '(setq org-confirm-babel-evaluate nil)' --funcall org-export-as-html

Also, note that when you run emacs with -batch, you init file is *not* evaluated,
so it does not help to have settings there......  Any settings you need must be on the command line,
of in a separate file that you will load with

   emacs -batch -l settings.el .........

For some background info on the prompt about evaluation, check out

http://orgmode.org/manual/Code-evaluation-security.html#Code-evaluation-security

- Carsten

P.S.  How is the VIM port coming along?


> 
> The export works fine except the ditaa png from ditaa source block doesn't get
> created.
> 
> I've run the export from within emacs and the ditaa png does get created.  The
> export also stops to present me with dialog asking whether I want to process the
> ditaa code, to which I respond Yes.  I don't get any dialog when I do the export
> from the command line.
> 
> Is there some way to get the ditaa code working when I do the export from the
> command line.
> 
> I'm running this on Windows7 if that makes any difference.
> 
> Thanks,
> 
> Herb
> 
> 

- Carsten

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

* Re: Problem with ditaa when doing export from command line
  2011-06-10  7:52 ` Carsten Dominik
@ 2011-06-10 15:47   ` Herbert Sitz
  2011-06-10 15:59     ` Herbert Sitz
  2011-06-10 16:21     ` Nick Dokos
  0 siblings, 2 replies; 8+ messages in thread
From: Herbert Sitz @ 2011-06-10 15:47 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik <at> gmail.com> writes:

> On Jun 10, 2011, at 9:33 AM, Herbert Sitz wrote:
> 
> > I'm trying to do an export by calling emacs from the command line like so:
> > 
> > emacs -batch --visit=myfilename --funcall org-export-as-html
> 
> maybe you need to do
> 
> emacs -batch --visit=myfilename --eval '(setq org-confirm-babel-evaluate nil)'
--funcall org-export-as-html
> 

After adding the eval switch the export terminates shortly after starting.  I
get messages:
---------------------
Adding c:/Program Files (x86)/Emacs/EmacsW32/lisp/ to load-path
OVERVIEW
End of file during parsing
---------------------

Same message has happened in several files, doesn't matter whether there's ditaa
code block in .org file or not.  I also get basically same result if I load my
.emacs file explicitly, although in that case I see some 'Loading . . .'
messages before OVERVIEW and End of file message.


> Also, note that when you run emacs with -batch, you init file is *not*
evaluated, . . . 

Thanks for those tips, had forgotten about loading of settings, though .emacs
was still getting loaded. . .

> 
> P.S.  How is the VIM port coming along?
> 

It's coming along slowly but fairly steadily.  I'm trying to wrap up the current
loose ends and get a major update out.  For first time I will have menu system
and some (very) basic documentation.  Lack of discoverability and docs have
(understandably) hindered adoption for many people so far, I think.

Regards,

Herb

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

* Re: Problem with ditaa when doing export from command line
  2011-06-10 15:47   ` Herbert Sitz
@ 2011-06-10 15:59     ` Herbert Sitz
  2011-06-10 16:21     ` Nick Dokos
  1 sibling, 0 replies; 8+ messages in thread
From: Herbert Sitz @ 2011-06-10 15:59 UTC (permalink / raw)
  To: emacs-orgmode

Herbert Sitz <hsitz <at> nwlink.com> writes:

> 
> Thanks for those tips, had forgotten about loading of settings, though .emacs
> was still getting loaded. . .
> 

That was a typo, meant to say, "I thought .emacs was still getting loaded."

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

* Re: Problem with ditaa when doing export from command line
  2011-06-10 15:47   ` Herbert Sitz
  2011-06-10 15:59     ` Herbert Sitz
@ 2011-06-10 16:21     ` Nick Dokos
  2011-06-10 19:18       ` Herbert Sitz
  1 sibling, 1 reply; 8+ messages in thread
From: Nick Dokos @ 2011-06-10 16:21 UTC (permalink / raw)
  To: Herbert Sitz; +Cc: nicholas.dokos, emacs-orgmode

Herbert Sitz <hsitz@nwlink.com> wrote:

> Carsten Dominik <carsten.dominik <at> gmail.com> writes:
> 
> > On Jun 10, 2011, at 9:33 AM, Herbert Sitz wrote:
> > 
> > > I'm trying to do an export by calling emacs from the command line like so:
> > > 
> > > emacs -batch --visit=myfilename --funcall org-export-as-html
> > 
> > maybe you need to do
> > 
> > emacs -batch --visit=myfilename --eval '(setq org-confirm-babel-evaluate nil)'
> --funcall org-export-as-html
> > 
> 
> After adding the eval switch the export terminates shortly after starting.  I
> get messages:
> ---------------------
> Adding c:/Program Files (x86)/Emacs/EmacsW32/lisp/ to load-path
> OVERVIEW
> End of file during parsing
> ---------------------
> 
> Same message has happened in several files, doesn't matter whether there's ditaa
> code block in .org file or not.  I also get basically same result if I load my
> .emacs file explicitly, although in that case I see some 'Loading . . .'
> messages before OVERVIEW and End of file message.
> 
> 
> > Also, note that when you run emacs with -batch, you init file is *not*
> evaluated, . . . 
> 
> Thanks for those tips, had forgotten about loading of settings, though .emacs
> was still getting loaded. . .
> 

Works fine for me here, so there is probably a syntax error in the lisp
file(s) you load or the lisp code you eval - try using a minimal setup
file as shown below:

GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.22.0) of 2011-04-13
Org-mode version 7.5 (baseline.273.g889a48)


I do

   emacs -batch --visit=foo.org  -l export.el --funcall org-export-as-html


with export.el containing the following:

--8<---------------cut here---------------start------------->8---
(setq org-confirm-babel-evaluate nil)
(require 'ob-ditaa)
(setq org-babel-temporary-directory "tmp")
(setq org-ditaa-jar-path "/home/nick/elisp/org-mode/contrib/scripts/ditaa.jar")
--8<---------------cut here---------------end--------------->8---


and foo.org containing the following:

--8<---------------cut here---------------start------------->8---

* Export a picture

Need to load ob-ditaa to execute these:

#+begin_src ditaa :file image.png :cmdline -r :exports both
+---------+
| cBLU    |
|         |
|    +----+
|    |cPNK|
|    |    |
+----+----+
#+end_src

#+results:
[[file:image.png]]


#+begin_src ditaa :file image2.png :cmdline -r :exports both
    +--------+   +-------+    +-------+
    |        | --+ ditaa +--> |       |
    |  Text  |   +-------+    |diagram|
    |Document|   |!magic!|    |       |
    |     {d}|   |       |    |       |
    +---+----+   +-------+    +-------+
        :                         ^
        |       Lots of work      |
        +-------------------------+
#+end_src

#+results:
[[file:image2.png]]

#+begin_src ditaa :file image3.png :cmdline -r :exports both
/--------\                /---------\
| cRED   | <------------- | cBLU    |
| page   |                |  page   |
|        |                | table   |
\--------/                |         |
                          |         |
                          \---------/

#+end_src

#+results:
[[file:image3.png]]
--8<---------------cut here---------------end--------------->8---


Nick

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

* Re: Problem with ditaa when doing export from command line
  2011-06-10 16:21     ` Nick Dokos
@ 2011-06-10 19:18       ` Herbert Sitz
  2011-06-10 19:42         ` Nick Dokos
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Sitz @ 2011-06-10 19:18 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <nicholas.dokos <at> hp.com> writes:
> Works fine for me here, so there is probably a syntax error in the lisp
> file(s) you load or the lisp code you eval - try using a minimal setup
> file as shown below:
> 
> 
> I do
> 
>    emacs -batch --visit=foo.org  -l export.el --funcall org-export-as-html
> 
> with export.el containing the following:
> 
> --8<---------------cut here---------------start------------->8---
>  setq org-confirm-babel-evaluate nil)
>  require 'ob-ditaa)
>  setq org-babel-temporary-directory "tmp")
>setq org-ditaa-jar-path "/home/nick/elisp/org-mode/contrib/scripts/ditaa.jar")
> --8<---------------cut here---------------end--------------->8---
> 

Nick -- Thanks very much, I did get it working with your help.  

However I could not get it to work if I used an --eval in the 
command line, had to move the assignment into setting.el to get it to work.  
Did you get it to work with an --eval statement in the command line?

-- Herb

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

* Re: Problem with ditaa when doing export from command line
  2011-06-10 19:18       ` Herbert Sitz
@ 2011-06-10 19:42         ` Nick Dokos
  2011-06-10 20:54           ` Herbert Sitz
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Dokos @ 2011-06-10 19:42 UTC (permalink / raw)
  To: Herbert Sitz; +Cc: nicholas.dokos, emacs-orgmode

Herbert Sitz <hsitz@nwlink.com> wrote:

> Nick Dokos <nicholas.dokos <at> hp.com> writes:
> > Works fine for me here, so there is probably a syntax error in the lisp
> > file(s) you load or the lisp code you eval - try using a minimal setup
> > file as shown below:
> > 
> > 
> > I do
> > 
> >    emacs -batch --visit=foo.org  -l export.el --funcall org-export-as-html
> > 
> > with export.el containing the following:
> > 
> > --8<---------------cut here---------------start------------->8---
> >  setq org-confirm-babel-evaluate nil)
> >  require 'ob-ditaa)
> >  setq org-babel-temporary-directory "tmp")
> >setq org-ditaa-jar-path "/home/nick/elisp/org-mode/contrib/scripts/ditaa.jar")
> > --8<---------------cut here---------------end--------------->8---
> > 
> 
> Nick -- Thanks very much, I did get it working with your help.  
> 
> However I could not get it to work if I used an --eval in the 
> command line, had to move the assignment into setting.el to get it to work.  
> Did you get it to work with an --eval statement in the command line?
> 

That's probably a quoting problem (you are on Windoze, right?) The command line
on Windoze sucks raw eggs (well, not just the command line, but I'm biased :-).

On Linux, I used two kinds of quotes in order to protect the vulnerable characters
inside each lisp sexp (you could also use backslashes strategically):

   emacs -batch --visit foo.org --eval '(setq org-confirm-babel-evaluate nil)'\
                                --eval "(require 'ob-ditaa)"\
                                --eval '(setq org-babel-temporary-directory "tmp")'\
                                --eval '(setq org-ditaa-jar-path "/home/nick/elisp/org-mode/contrib/scripts/ditaa.jar")'\
                                --funcall org-export-as-html

Inconvenient, but it works.

Nick

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

* Re: Problem with ditaa when doing export from command line
  2011-06-10 19:42         ` Nick Dokos
@ 2011-06-10 20:54           ` Herbert Sitz
  0 siblings, 0 replies; 8+ messages in thread
From: Herbert Sitz @ 2011-06-10 20:54 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <nicholas.dokos <at> hp.com> writes:
>That's a quoting problem (you are on Windoze, right?) The command line
>on Windoze sucks raw eggs (well, not just the command line, but I'm biased .

You are correct, sir!  Thanks, it is indeed a quoting problem.

> 
> On Linux, I used two kinds of quotes in order to protect the 
> vulnerable characters
> inside each lisp sexp (you could also use backslashes strategically):
> 
>    emacs -batch --visit foo.org --eval '(setq org-confirm-babel-evaluate nil)'\
>                                 --eval "(require 'ob-ditaa)"\
>                                 --eval '(setq org-babel-temporary-directory
"tmp")'\
>                                 --eval '(setq org-ditaa-jar-path
"/home/nick/elisp/org-mode/contrib/scripts/ditaa.jar")'\
>                                 --funcall org-export-as-html
> 
> Inconvenient, but it works.

Okay, here's what seems to work on Windoze.  Don't laugh:

emacs -batch --visit foo.org ^
           --eval ^"(setq org-confirm-babel-evaluate nil)^" ^
           --eval ^"(require 'ob-ditaa)^" ^
           --eval ^"(setq org-babel-temporary-directory \^"tmp\^")^" ^
           --eval ^"(setq org-ditaa-jar-path \^"/home/nick/elisp/org-mode
/contrib/scripts/ditaa.jar\^")^" ^
           --funcall org-export-as-html

There is actually some reason to the rhyme, which is explained here:
http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx

Thanks again.

-- Herb

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

end of thread, other threads:[~2011-06-10 20:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-10  7:33 Problem with ditaa when doing export from command line Herbert Sitz
2011-06-10  7:52 ` Carsten Dominik
2011-06-10 15:47   ` Herbert Sitz
2011-06-10 15:59     ` Herbert Sitz
2011-06-10 16:21     ` Nick Dokos
2011-06-10 19:18       ` Herbert Sitz
2011-06-10 19:42         ` Nick Dokos
2011-06-10 20:54           ` Herbert Sitz

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.