all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* diff-mode documentation
@ 2006-03-08 17:07 Aaron S. Hawley
  2006-03-09 17:14 ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Aaron S. Hawley @ 2006-03-08 17:07 UTC (permalink / raw)


[-- Attachment #1: Type: TEXT/PLAIN, Size: 3030 bytes --]

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 M-@}
@findex diff-file-next
Move to the next file hunk in a multiple file patch.

@item M-@{
@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 #2: Patch to files.texi --]
[-- Type: TEXT/PLAIN, Size: 2890 bytes --]

--- files.texi	06 Mar 2006 22:56:44 -0500	1.133
+++ files.texi	07 Mar 2006 18:27:41 -0500	
@@ -2999,7 +2999,87 @@
 @cindex patches
   Differences between versions of files are often distributed as
 patches, which are the output from the @command{diff} program.  You
-can use Diff mode to operate on a patch by typing @kbd{M-x diff-mode}.
+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 M-@}
+@findex diff-file-next
+Move to the next file hunk in a multiple file patch.
+
+@item M-@{
+@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
 
 @findex compare-windows
   The command @kbd{M-x compare-windows} compares the text in the

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-03-14 17:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-08 17:07 diff-mode documentation Aaron S. Hawley
2006-03-09 17:14 ` Richard Stallman
2006-03-09 19:58   ` Aaron S. Hawley
2006-03-11  0:07     ` Richard Stallman
2006-03-14 14:50   ` Aaron S. Hawley
2006-03-14 16:15     ` Stefan Monnier
2006-03-14 17:46     ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.