joostkremers / pandoc-mode

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

pandoc-mode cannot find the pandoc binary on Mac OS X #24

Closed Guillawme closed 9 years ago

Guillawme commented 9 years ago

Hello,

First of all, thank you very much for this well designed mode. It is very useful and finally makes Emacs the perfect tool for my writing needs. :smiley:

So this is not really a bug, but here is what happens: on Mac OS X with a default (or close-to-default) Emacs configuration, pandoc-mode cannot find the pandoc binary. This is not properly a bug because it's apparently independant of pandoc-mode: I tried on Windows 7 with same versions of Emacs (plus same config), pandoc-mode and pandoc and it worked fine.

I first thought of a problem with my $PATH variable, I checked it and also tried to call pandoc from the terminal: it worked as expected. After further investigation, I discovered that on Mac OS X, when started by clicking on Emacs.app, Emacs doesn't read the content of $PATH. Actually in my case, Emacs' exec-path variable contains its own stuff plus /usr/bin and other similar locations, but not /usr/local where pandoc was put by the official installer (/usr/local and subsequent locations are of course in my $PATH). This seems strange to me, because I expected exec-path would contain either all the contents of $PATH or something else, but not a weird mix of a subset of $PATH plus something else.

Anyway, there is a workaround. Installing this Emacs package and setting it up as indicated in its documentation is sufficient to solve the issue and get pandoc-mode fully functional.

You could add exec-path-from-shell as a dependency to pandoc-mode, but users of other OS could be annoyed by an unnecessary dep, and I don't think package.el can handle deps conditionnaly based on the OS Emacs runs on.

I think you should at the very least inform users about this situation with Mac OS X (the install instructions or readme seem like a good place for such a warning). This could be sufficient because the workaround is easy to get working, but of course if you see a solution more transparent to the user it would be great as well.

Thanks again for this wonderful mode, -- a happy user.

joostkremers commented 9 years ago

Hi, I was actually aware of this problem, since I used to have an OS X machine as well. (I no longer have it, thank $DEITY...) I used to have a comment about this somewhere in the documentation, I think, but obviously it's no longer there.

As you point out, adding exec-path-from-shell as a dependency doesn't look like a good idea because it's only needed on OS X. And even on OS X, some users might prefer to simply customise the option pandoc-binary to point to /usr/local/bin/pandoc (or wherever it's installed). It's a good idea, though, to add a comment to the documentation and point to https://github.com/purcell/exec-path-from-shell as a simple solution.

joostkremers commented 9 years ago

Done.

Thanks for reminding me of this issue. Good to hear that pandoc-mode is useful to you!

Guillawme commented 9 years ago

Thank you. :+1: