emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

diff-mode documentation


From: Aaron S. Hawley
Subject: diff-mode documentation
Date: Wed, 8 Mar 2006 12:07:43 -0500 (EST)

The commands and features of Diff mode aren't entirely documumented in the
Emacs manual.  The following is a patch to files.texi that would add some.
There may exist a more appropriate location in the manual (or Emacs) for
this all to go. Stefan Monnier, the author of Diff mode, has provided
helpful feedback to me on this patch.  However, any mistakes are my own.

I've tried adopting the style for command tables found elsewhere in the
manual.  The patch also adds discussion of Diff mode's brilliant feature
to interactively correct the patch after any manual edits by the user.

Hope this helps,
/a

----

  Differences between versions of files are often distributed as
patches, which are the output from the @command{diff} program.  You
can use the same Diff mode to operate on a patch by typing @kbd{M-x
diff-mode}.  Any manual edits you make to a patch with Diff mode will
automatically correct the hunk header including insert, delete and
file line numbers.  Also, the following commands help to navigate,
manipulate and apply patches in Diff mode:

@table @kbd
@item M-n
@findex diff-hunk-next
Move to the next hunk in the patch.

@item M-p
@findex diff-hunk-prev
Move to the previous hunk in the patch.

@item address@hidden
@findex diff-file-next
Move to the next file hunk in a multiple file patch.

@item address@hidden
@findex diff-file-prev
Move to the previous file hunk in a multiple file patch.

@item M-k
@findex diff-hunk-kill
Kill the current hunk at point.

@item M-K
@findex diff-file-kill
In a patch with multiple files, kill the current patch to a file.

@item C-c C-s
@findex diff-split-hunk
Split the hunk at point. This is useful when manually editing a patch
and only works with the unified diff format.

@item C-c C-r
@findex diff-refine-hunk
Recomputes the current hunk by ignoring changes in whitespace.

@item M-R
@findex diff-reverse-direction
Convert the patch to a patch that reverts.
@xref{Reversed Patches, Applying Reversed Patches, Patch, diff,
Comparing and Merging Files}.

@item M-U
@findex diff-context->unified
Convert the patch to the unified diff format.
@xref{Unified Format, Unified Format, Diff, diff,
Comparing and Merging Files}.

@item M-C
@findex diff-unified->context
Convert the patch back to context diff format.
@xref{Context Format, Context Format, Diff, diff,
Comparing and Merging Files}.

@item M-r
@findex diff-restrict-view
@findex widen
Restrict the view to the current hunk. @xref{Narrowing}.  With a
prefix argument of @kbd{C-u} restrict the view to the current patch of
a multiple file patch.  The view can be widened again with @kbd{M-W}.

@item C-c C-a
@findex diff-apply-hunk
Apply hunk to target file.  With a prefix argument of @kbd{C-u}, apply
the reverse of the hunk.

@item M-A
@findex diff-ediff-patch
Start an Ediff session with the patch.
@xref{Top, Ediff, Ediff, ediff, The Ediff Manual}.

@item C-x 4 a
Add a new entry to the change log for the current file.  @xref{Change
Log}.  This is useful for log entries for functions that are deleted
by the patch.

@end table

Attachment: files.texi-diffmode.diff
Description: Patch to files.texi


reply via email to

[Prev in Thread] Current Thread [Next in Thread]