paetzke / py-isort.el

py-isort.el integrates isort into Emacs.
GNU General Public License v3.0
89 stars 16 forks source link

Error calling "diff" on Windows #16

Open tgroshon opened 6 years ago

tgroshon commented 6 years ago

When using py-isort on Emacs 25.3 Windows 10 Pro, it fails with the following message:

Searching for program: No such file or directory, diff

Installing isort and calling it from powershell works.

The failure seems to be when calling diff to see if the file was isorted or not: https://github.com/paetzke/py-isort.el/blob/master/py-isort.el#L153

Is there a way to do the same operation without using diff?

tgroshon commented 6 years ago

I got around this issue by just running isort on save of every python file.

(defun my-isort ()
  "When in Python Mode, call isort on save"
  (when (eq major-mode 'python-mode)
    (shell-command-to-string (format "isort %s" buffer-file-name))))

;; Run on file save
(add-hook 'after-save-hook 'my-isort)