22

I'd like to be able to open two windows in Emacs, select a region of text in each window, and get a comparison of the difference between the two selections.

This would be very handy for a large-scale maintenance project, where I'm working on a version tree with multiple branches, lots of copy/paste, and code that is being moved around sporadically.

I've found a paid-for tool that does provide this function (Ultracompare), but it's windows-specific, and I need a solution that runs on Solaris/Linux.

nbro
  • 15,395
  • 32
  • 113
  • 196
gmc444
  • 241
  • 2
  • 5

2 Answers2

36

I think M-x ediff-regions-wordwise does what you want.

Run ediff-regions-wordwise and Emacs will prompt for each buffer, then prompt you to select (or confirm) a region in the buffer.

And, bonus, Emacs runs on Windows too!

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
Dave Bacher
  • 15,652
  • 3
  • 63
  • 86
  • That's nice, but could you tell, how do I finally see the differences? It just showed two windows with my selections, and one for entering a commands. From the list of a commands it is absolutely unclear how to use it. – Hi-Angel Dec 01 '14 at 09:08
9

I'd be inclined to use narrow-to-region (C-x n n) in both buffers followed by M-x compare-windows if only because it has worked for me for at least 100 years. :-)

pajato0
  • 3,628
  • 3
  • 31
  • 37