19

I have Emacs version 23 on Windows and it seem the ediff executable is missing?

From where can I download ediff for Emacs on Windows?

phils
  • 71,335
  • 11
  • 153
  • 198
sam
  • 291
  • 1
  • 2
  • 5

6 Answers6

15

If you have git for windows installed, then it is enough to add

C:\Program Files\Git\usr\bin\

to your PATH environment variable, because git for windows already ships with a diff executable and installs it in that folder.

FlyingFoX
  • 3,379
  • 3
  • 32
  • 49
  • 2
    Note that if you do not want to modify your path, you can modify the exec-path in your emacs initialization file to contain this directory as well (exec-path is the PATH list). Example: (push "C:/Program Files/Git/usr/bin" exec-path) – Marie R Jan 22 '22 at 21:16
4

You can download diffUtils, extract it, add the path to %PATH% and emacs exec-path in your Emacs init file like that.

(when (string-equal system-type "windows-nt")
  (progn
    (setq diff-path "your-diff-path")
    (setenv "PATH"
            (concat diff-path ";"))
    (setq exec-path
          '(diff-path))))

finally, using M-x diff to compare what you want.

Ender Wan
  • 119
  • 5
3

It's probably a Windows-native diff that you're missing. You really want to have access to a suite of additional Unix-like tools when you run NTEmacs.

Cygwin is probably the most common solution. Many people use the GNUWin32 tools instead ("much faster, though less complete, than the Cygwin ones").

See here for more details: How to best integrate Emacs and Cygwin?

Emacs Wiki: http://www.emacswiki.org/emacs/CygWin

Be aware that as well as NTEmacs, there is a Cygwin-native Emacs as well. So you can either use NTEmacs with Cygwin providing all the additional tools; or you can ignore NTEmacs entirely, and install Cygwin's Emacs package and just use that. NTEmacs is faster, but Cygwin Emacs integrates better with the rest of Cygwin in a few areas.

Community
  • 1
  • 1
phils
  • 71,335
  • 11
  • 153
  • 198
2

When you run ediff from emacs, it does indeed look for an executable diff. One way to get it is to install cygwin. You don't have to use Emacs from cygwin to use diff. Just add c:\cygwin\bin (use your cygwin install path) to %PATH% and restart emacs.

Now when you run ediff, it will find diff.exe in your %PATH%.

Ediff in emacs on Windows 7

user443854
  • 7,096
  • 13
  • 48
  • 63
  • Didn't work because it didn't like windows paths. (Might work if I was using Cygwin emacs, but that wasn't really the specified problem.) – AdamC Oct 09 '13 at 20:35
  • 1
    @AdamC: It works outside of cygwin. I attached a screenshot exactly to demonstrate this. What error are you getting? Who did not like what? – user443854 Oct 09 '13 at 21:08
  • @AdamC I ended up installing http://gnuwin32.sourceforge.net/packages/diffutils.htm and adding the install path to my ``PATH`` env var - that did it. (You'll need to logout/log back in to have everything recognized.) This is of course old but may be helpful for future googlers. – Conrad Dec 19 '14 at 19:40
0

Ediff uses the diff utility so on MS Windows you need to set up diff first in order to use Ediff normally. If you already have Git installed then you can use the diff executable packaged with it. Or you can use the single diffutils. In order for Emacs to find the executable you can add its path (e.g. C:\Program Files\Git\usr\bin) to the Windows environment variable PATH and then restart Emacs. However, if you don't want to restart Emacs all over you can simply add the path to the Emacs variable exec-path without changing PATH. But this will litter you init file with extra configurations. Another way to add the path to exec-path without restarting Emacs or generating extra lines in your init file is like this:

  1. Add the executable path to the Windows environment variable PATH;
  2. Change the Emacs environment variable PATH (using M-x setenv PATH) to that returned by echo %PATH% from CMD;
  3. By default exec-path is the same as PATH. By changing PATH manually the original value of exec-path also changes. So you can revert its value to the original to synchronize with PATH. From the customizing panel (M-x customize-variable exec-path) click Revert... and choose 2 - Erase Customizations.
Joseph Tesfaye
  • 814
  • 14
  • 26
-1

There isn't an executable for ediff.

ediff is a lisp program that runs within emacs. If you would like to run it from the command line, take a look at this documentation.

tshepang
  • 12,111
  • 21
  • 91
  • 136
ataylor
  • 64,891
  • 24
  • 161
  • 189
  • 4
    But when using ediff on Windows, Emacs complains about that the diff executable is missing: `apply: Searching for program: no such file or directory, diff` – Peter Jaric Jul 03 '13 at 08:15
  • 3
    @ataylor: Sure there is. Ediff mode in emacs runs program `diff`. Look at ediff-diff.el, this line: `(apply 'start-process "Custom Diff" buffer program args))`. Just turn on `debug-on-error` in Windows and run ediff to see for yourself. – user443854 Sep 20 '13 at 16:40