开发者

How can I use ediff under Windows + NTEmacs?

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

From where can I download ed开发者_Go百科iff for Emacs on Windows?


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.


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.


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.


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%.

How can I use ediff under Windows + NTEmacs?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜