Commit a9ccfaef authored by Dmitry Gutov's avatar Dmitry Gutov

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'.
parent e192281b
......@@ -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".
......
......@@ -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.
......
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment