The command M-x diff prompts for two file names, using the
minibuffer, and displays the differences between the two files in a
buffer named ‘*diff*’. This works by running the diff
program, using options taken from the variable
The value of
diff-switches should be a string; the default is
"-c" to specify a context diff. See , for more information about
diff output formats.
The output of the
diff command is shown using a major mode
called Diff mode. See Diff Mode.
The command M-x diff-backup compares a specified file with its
most recent backup. If you specify the name of a backup file,
diff-backup compares it with the source file that it is a
backup of. In all other respects, this behaves like M-x diff.
The command M-x diff-buffer-with-file compares a specified buffer with its corresponding file. This shows you what changes you would make to the file if you save the buffer.
The command M-x compare-windows compares the text in the current window with that in the next window. (For more information about windows in Emacs, Windows.) Comparison starts at point in each window, after pushing each initial point value on the mark ring in its respective buffer. Then it moves point forward in each window, one character at a time, until it reaches characters that don't match. Then the command exits.
If point in the two windows is followed by non-matching text when the command starts, M-x compare-windows tries heuristically to advance up to matching text in the two windows, and then exits. So if you use M-x compare-windows repeatedly, each time it either skips one matching range or finds the start of another.
With a numeric argument,
compare-windows ignores changes in
whitespace. If the variable
nil, the comparison ignores differences in case as well.
If the variable
compare-ignore-whitespace is non-
compare-windows normally ignores changes in whitespace, and a
prefix argument turns that off.
You can use M-x smerge-mode to turn on Smerge mode, a minor mode for editing output from the diff3 program. This is typically the result of a failed merge from a version control system “update” outside VC, due to conflicting changes to a file. Smerge mode provides commands to resolve conflicts by selecting specific changes.
See Emerge, for the Emerge facility, which provides a powerful interface for merging files.blog comments powered by Disqus