[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

23.11 Diff Mode

Diff mode is used for the output of M-x diff; it is also useful for editing patches and comparisons produced by the diff program. To select Diff mode manually, type M-x diff-mode.

One general feature of Diff mode is that manual edits to the patch automatically correct line numbers, including those in the hunk header, so that you can actually apply the edited patch. Diff mode treats each hunk location as an “error message,” so that you can use commands such as C-x ' to visit the corresponding source locations. It also provides the following commands to navigate, manipulate and apply parts of patches:

M-n

Move to the next hunk-start (diff-hunk-next).

M-p

Move to the previous hunk-start (diff-hunk-prev).

M-}

Move to the next file-start, in a multi-file patch (diff-file-next).

M-{

Move to the previous file-start, in a multi-file patch (diff-file-prev).

M-k

Kill the hunk at point (diff-hunk-kill).

M-K

In a multi-file patch, kill the current file part. (diff-file-kill).

C-c C-a

Apply this hunk to its target file (diff-apply-hunk). With a prefix argument of C-u, revert this hunk.

C-c C-c

Go to the source corresponding to this hunk (diff-goto-source).

C-c C-e

Start an Ediff session with the patch (diff-ediff-patch). Voir Ediff: (ediff)Top section `Ediff' dans The Ediff Manual.

C-c C-n

Restrict the view to the current hunk (diff-restrict-view). Voir la section Narrowing. With a prefix argument of C-u, restrict the view to the current patch of a multiple file patch. To widen again, use C-x n w.

C-c C-r

Reverse the direction of comparison for the entire buffer (diff-reverse-direction).

C-c C-s

Split the hunk at point (diff-split-hunk). This is for manually editing patches, and only works with the unified diff format.

C-c C-u

Convert the entire buffer to unified format (diff-context->unified). With a prefix argument, convert unified format to context format. In Transient Mark mode, when the mark is active, this command operates only on the region.

C-c C-w

Refine the current hunk so that it disregards changes in whitespace (diff-refine-hunk).

C-x 4 a in Diff mode operates on behalf of the target file, but gets the function name from the patch itself. Voir la section Change Logs. This is useful for making log entries for functions that are deleted by the patch.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 23 Février 2009 en utilisant texi2html 1.78.