Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a couple of questions about comparing text files on Emacs

  1. I have been playing with M-x compare-windows and I read in the documentation that, if I pass it a numeric argument, Emacs ignores whitespaces on the comparison, but how do I pass a numeric argument to this command? (e.g.. if I type M-x compare-windows and then I press space, it will try to autocomplete with a -)

  2. Are there any other more powerful tools or plugins for Emacs (maybe third-party?) for comparing text files?

    For example, on WinMerge for Windows, you can compare two documents side-by-side and the program automatically highlights the differences. On WinMerge I can also simultaneously scroll both windows, and it aligns regions with identical text on both windows for easy comparison. See a snapshot here.

    Is there anything like this for Emacs?

share|improve this question
up vote 5 down vote accepted

To pass a numeric argument to a command, enter the argument first. For example, Escape 3 Left moves 3 characters left. So type ESC 3 ESC x compare-windows RET or M-3 M-x compare-windows RET.

The most frequently used commands to compare two files are those of ediff. You can invoke them from the “Tools > Compare (Ediff)” menu. There is a command called ediff-windows-linewise, though usually you would compare two buffers (ediff-buffers) or two files (ediff-files) or two revisions under a version control system (ediff-revision). Press n and p to navigate between diff regions; press ? to see more available commands.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.