prettier-emacs icon indicating copy to clipboard operation
prettier-emacs copied to clipboard

Requires `diff` on Windows

Open kraai opened this issue 6 years ago • 7 comments

When I installed prettier-emacs on Windows and saved a file with an incorrect style, the saved file still had the incorrect style. I did not see an error message displayed on the last line of the window. When I checked the contents of the *Messages* buffer, however, I saw that there was an error trying to run diff:

Saving file c:/Users/mkraai/src/calculator/online/server.js...
Wrote c:/Users/mkraai/AppData/Local/Temp/1/prettier9292Lab.js
Error: (file-error "Searching for program" "No such file or directory" "diff")
Wrote c:/Users/mkraai/src/calculator/online/server.js

Once I installed the MSYS version of diff, added the MSYS bin directory to my path, and restarted Emacs, the style was corrected when I saved the file.

I'm not sure how to fix this. Here are some possibilities:

  • Display an error indicating that diff couldn't be found when saving the file.
  • Note that diff is required in README.md.
  • Modify prettier-emacs to not require diff.

kraai avatar Jan 03 '18 17:01 kraai

I would love if we were able to get rid of the diff dependency. Something I love about using emacs on Windows is that lisp "just works". When I used to use vim, I'd have to worry a lot about external commands and making sure they're installed.

Maybe there's a diff implementation in elisp that could be leveraged.

ryanolsonx avatar Jan 09 '18 16:01 ryanolsonx

Could the diff function in diff.el be used?

Also as a temporary workaround, I think there's a port of GNU diff on Chocolatey.

nickmccurdy avatar Feb 28 '18 17:02 nickmccurdy

Using @nickmccurdy suggesting to choco install diffutils solved the problem for me. It would be great if we didn't have to install that OR we could just update the docs and say that Windows users should do that.

tgroshon avatar Jul 11 '18 22:07 tgroshon

@tgroshon do you mind doing a PR with the updated README?

thanks!

rcoedo avatar Jul 12 '18 06:07 rcoedo

Absolutely. I will post one today.

tgroshon avatar Jul 12 '18 13:07 tgroshon

Any update on this? I am running into prettier emacs issues as well

Kethku avatar Mar 09 '19 01:03 Kethku

Can't believe I forgot to make a PR for that README.md change 🤦‍♂️ Just made one! The basic steps are as follows:

  1. Install Chocolatey: https://chocolatey.org/install
  2. Open an Admin Powershell session
  3. Install the diff program: choco install diffutils

tgroshon avatar Mar 11 '19 16:03 tgroshon