SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions

EdiffOnWThirtyTwo

EdiffMode is great. It needs a couple of diff-tools to work though. You have at least these options to get them:

If you use CygWin way all should work nicely after installing CygWin (I think it adds itself to the path, otherwise you have to do that manually).

I use these libraries with CygWin. You might find them useful too.

DrewAdams

If you get the natively compiled tools from Sourceforge or Simtel, put the diff-tools (diff.exe, diff3.exe and cmp.exe) in a directory on your PATH. On Win2000 or WinXP, you can edit the PATH by going to Control Panel→System→Advanced→Environment Variables.

Ediff away!


I wanted to use ediff as my diff tool in Perforce, but Perforce requires an executable to call, and “bash my-shell-script-hack.sh” didn’t work. I wrote this short hack, which works for me (compiled with gcc / cygwin) when it and gnuclientw are in my path.

#include <stdio.h>
#include <stdlib.h>

/* 
 * call-ediff is used to call ediff from Perforce.  
 * gcc -o call-ediff call-ediff.c && call-ediff y:/Source/find_audio_xmls.sh y:/Source/find_audio_xmls.sh~
 */

void hackPathSeparator(char *windozePath) {
    char *c;

    for (c = windozePath; *c; c++) {
	if ('\\' == *c)
	    *c = '/';
    }
}

int main(int argc, char *argv[], char *envp[]) {
    char *param1 = argv[1];
    char *param2 = argv[2];

    /* We get \ part separators from Perforce; hack these to / */

    hackPathSeparator(param1);
    hackPathSeparator(param2);

    /* hack the arg list (ugh) */

    argv[1] = "-e";
    /* Sample usage: argv[2] = "(progn (message \"foo\") (raise-frame))"; */

    char *command = (char *)malloc(4096);
    sprintf(command, "(progn (raise-frame) (ediff \"%s\" \"%s\"))", param1, param2);

    argv[2] = command;

    execvp("gnuclientw.exe", argv);
    return 0;
}


I’ve found that if you compile with these arguments you can avoid the console window: gcc -Wl,--subsystem,windows -o call-ediff call-ediff.c

Ediff example:

EdiffScreenshot


CategoryWThirtyTwo CategoryComparing