joostkremers / pandoc-mode

An Emacs minor mode for interacting with Pandoc.
https://joostkremers.github.io/pandoc-mode/
177 stars 14 forks source link

Can't export nothing under Cygwin #94

Closed xbelanch closed 4 years ago

xbelanch commented 5 years ago

After googling and "stack overflowing" still I don't figure out how I can't export a simple pdf every time I call pandoc-convert-to-pdf. Nothing happens except I can see it as a process that never ends:

pandoc-proce... 113 run *Pandoc out... /dev/pty2 pandoc --read=markdown --write=native

I'm running Emacs under Cygwin environment.

joostkremers commented 5 years ago

What's in the *Pandoc log* buffer? It should record the exact call to Pandoc. If you call pandoc-convert-to-pdf there should be an output file with a .pdf extension, and the --write option should be latex, html or ms, so the process that you mention couldn't really come from a call to pandoc-corvert-to-pdf.

A hanging pandoc process can be caused by an input buffer that doesn't end in a final empty line, but pandoc-mode tries to compensate for this, so that shouldn't be the cause. Of course, I don't know much about Cygwin, so it's possible there's something I'm not aware of.

Could you check the *Pandoc log* buffer and post what it shows, and also check the *Pandoc output* buffer, to see if there's anything in it? (If you're converting to pdf, there shouldn't be.)

Also, it might be helpful to know which Emacs version, which Pandoc version and (especially) which version (commit) of pandoc-mode you're using.

Also, there's an option pandoc-use-async, which is normally set to t, but some users have reported only being able to call Pandoc when this option is unset. That might be worth a try.

xbelanch commented 5 years ago

Also, it might be helpful to know which Emacs version, which Pandoc version and (especially) which version (commit) of pandoc-mode you're using.

Emacs: GNU Emacs 26.3 (build 1, x86_64-pc-cygwin) of 2019-08-30 Pandoc: pandoc.exe 2.7.3 Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.8.1 pandoc-mode: 2.27.2

Also, there's an option pandoc-use-async, which is normally set to t, but some users have reported only being able to call Pandoc when this option is unset. That might be worth a try.

I added (setq pandoc-use-async nil) and this happens when I try to exporting to pdf:

Error producing PDF.
! Undefined control sequence.
l.119 ...ots{} Cal obrir el directori **C:\Program

Well, this markdown has an issue. A simple "hello world" markdown files gives this error:

pandoc.exe: /cygdrive/d/IOC/miniops/llegir-en-xarxa//README.pdf: openBinaryFile: does not exist (No such file or directory)

Guess emacs didn't find the pandoc binary?

Could you check the Pandoc log buffer and post what it shows, and also check the Pandoc output buffer, to see if there's anything in it? (If you're converting to pdf, there shouldn't be.)

Sun Oct  6 18:04:08 2019

Calling pandoc with:

pandoc --read=markdown --write=latex --output=/cygdrive/p/icgc/icgc_ulldeter_terrain/source/docs//arma3terrain.pdf
arma3terrain.md: Error in pandoc process

Hope it helps to find a workaround.

joostkremers commented 4 years ago

I added (setq pandoc-use-async nil) and this happens when I try to exporting to pdf:

Error producing PDF.
! Undefined control sequence.
l.119 ...ots{} Cal obrir el directori **C:\Program

That looks like a LaTeX error. You should try to run the command on the (Cygwin) command line and post your question on the Pandoc mailing list.

Well, this markdown has an issue. A simple "hello world" markdown files gives this error:

pandoc.exe: /cygdrive/d/IOC/miniops/llegir-en-xarxa//README.pdf: openBinaryFile: does not exist (No such file or directory)

Guess emacs didn't find the pandoc binary?

Actually, it looks like pandoc.exe is found alright, but some other file cannot be found. Did you run this on the command line or from within Emacs with pandoc-mode?

xbelanch commented 4 years ago

Actually, it looks like pandoc.exe is found alright, but some other file cannot be found. Did you run this on the command line or from within Emacs with pandoc-mode?

From within Emacs with pandoc-mode:

and that's it if I run pandoc on the command line within Emacs:

joostkremers commented 4 years ago

That shows that pandoc.exe can be found, but it doesn't help much in solving your problem. Can you run the command that pandoc-mode uses to convert foo.md to pdf from the command line? Preferably outside of Emacs, but I guess running bash inside Emacs should be fine as well.

xbelanch commented 4 years ago

I think I found what's the root of that "happy mistake". See that capture:

Pretty self-explanatory I guess.

joostkremers commented 4 years ago

Do you mean to say that the directory /cygdrive/r/CV/ does not exist or isn't writable? Because that's what is suggests to me. In the first call:

pandoc --read=markdown --write=latex --output=/cygdrive/r/CV/cv.pdf

you didn't specify an input file, which means that pandoc will read from stdin. Since there seems to be no input, I assume pandoc didn't even try to create at output file, so that you didn't get an error.

xbelanch commented 4 years ago

Do you mean to say that the directory /cygdrive/r/CV/ does not exist or isn't writable? Because that's what is suggests to me.

/cygdrive/r/CV/ exists and it's writable.

you didn't specify an input file, which means that pandoc will read from stdin.

Well, that's the same call that I can see at the pandoc-view-log when i run pandoc-convert-to-pdf:

==================================================
Wed Oct  9 18:46:45 2019

Calling pandoc with:

pandoc --read=markdown --write=latex --output=/cygdrive/r/CV//cv.pdf

And as you say, if I didn't give an input file, it returns or get the last error. That's the thing I understand at the moment.

Sorry if I'm bothering you :-/ with all of this.

joostkremers commented 4 years ago

pandoc-mode calls pandoc without input file, providing the contents of the buffer through stdin. That's why there's no input file in the call to pandoc in the log buffer.

My suggestion would be to find out why you get an error when you provide the complete path to the output file when calling pandoc from the command line. That doesn't seem to be a problem in pandoc-mode, so I can't really help. It could be something special about Cygwin, or something to do with Pandoc, or the combination of both. I would suggest asking on Pandoc's mailing list first.