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'.
This commit is contained in:
Dmitry Gutov 2015-04-14 05:03:32 +03:00
parent e192281baa
commit a9ccfaefc1
4 changed files with 11 additions and 8 deletions

View file

@ -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".

View file

@ -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.

View file

@ -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

View file

@ -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)