From a9ccfaefc1ca8fa5b0177101984f64b3b186339b Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 14 Apr 2015 05:03:32 +0300 Subject: [PATCH] Change diff-switches default to `-u' Fixes: debbugs:20290 * doc/emacs/files.texi (Comparing Files): Document the new default value of `diff-switches'. * doc/emacs/trouble.texi (Sending Patches): Document the preference for unified diff format. Escape the plus in the suggested `-F' regexp value. * lisp/vc/diff.el (diff-switches): Change the default to `-u'. --- doc/emacs/files.texi | 2 +- doc/emacs/trouble.texi | 11 +++++------ etc/NEWS | 4 ++++ lisp/vc/diff.el | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index c4b0c11f68b..3a281d223b3 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1272,7 +1272,7 @@ minibuffer, and displays the differences between the two files in a buffer named @file{*diff*}. This works by running the @command{diff} program, using options taken from the variable @code{diff-switches}. The value of @code{diff-switches} should be a string; the default is -@code{"-c"} to specify a context diff. +@code{"-u"} to specify a unified context diff. @c Note that the actual name of the info file is diffutils.info, @c but it adds a dir entry for diff too. @c On older systems, only "info diff" works, not "info diffutils". diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 2c3de28628e..42022cd14f6 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -743,7 +743,7 @@ unmodified Emacs. But if you've made modifications and you don't tell us, you are sending us on a wild goose chase.) Be precise about these changes. A description in English is not -enough---send a context diff for them. +enough---send a unified context diff for them. Adding files of your own, or porting to another machine, is a modification of the source. @@ -1131,13 +1131,12 @@ is important. @item The patch itself. -Use @samp{diff -c} to make your diffs. Diffs without context are hard +Use @samp{diff -u} to make your diffs. Diffs without context are hard to install reliably. More than that, they are hard to study; we must -always study a patch to decide whether we want to install it. Unidiff -format is better than contextless diffs, but not as easy to read as -@samp{-c} format. +always study a patch to decide whether we want to install it. Context +format is better than contextless diffs, but we prefer we unified format. -If you have GNU diff, use @samp{diff -c -F'^[_a-zA-Z0-9$]+ *('} when +If you have GNU diff, use @samp{diff -u -F'^[_a-zA-Z0-9$]\+ *('} when making diffs of C code. This shows the name of the function that each change occurs in. diff --git a/etc/NEWS b/etc/NEWS index 8a9fa7c5c84..6d8b4c6faf8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -690,6 +690,10 @@ now match multibyte characters using Unicode character properties. If you want the old behavior where they matched any character with word syntax, use `\sw' instead. ++++ +** The `diff' command uses the unified format now. To restore the old +behavior, set `diff-switches' to `-c'. + * Lisp Changes in Emacs 25.1 diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index 062248c8f14..2a973cfdfb1 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -38,7 +38,7 @@ :group 'tools) ;;;###autoload -(defcustom diff-switches (purecopy "-c") +(defcustom diff-switches (purecopy "-u") "A string or list of strings specifying switches to be passed to diff." :type '(choice string (repeat string)) :group 'diff) -- 2.39.2