magit-diff-highlight-heading: cosmetics
magit-diff-popup: rebind "-U" and "--function-context"

Change the key bindings for the "-U" and "--function-context" arguments.
correctly handle popup options with empty values
magit-define-popup: always define the option

Always define the popup's argument option even when its name
is explicitly given as an argument to `magit-define-popup'.
magit-stash-mode: derive from magit-diff-mode
magit-revision-mode: derive from magit-diff-mode
magit-apply-patch: add --unidiff-zero when appropriate

Previously this was done in `magit-apply-diff'
and `magit-apply-hunk', now we do it here.
magit-diff-{less,more,default}-context: improve doc-strings
magit-diff-{set-context,context-p}: new functions

Add the new function `magit-diff-set-context' to do all the heavy
lifting for `magit-diff-{less,more,default}-context'.  This replaces
`magit-diff-previous-context-lines' which only determined the
current (aka previous) value.

The main advantage of this approach is that this will allow using
different variables in diff-only and also-diff buffers, which will be
implemented in a later commit.

By default Git shows three context lines, but until now we did not avoid
having the redundant argument "-U3" as a member of the arguments list.
`magit-diff-set-context' is now capable of doing that, but that also
means that `(not (member "-U0" args))' no longer is sufficient to check
whether any context lines are shown.  Add new `magit-diff-context-p' for
that purpose.
temporarily remove "update diff arguments" functionality

Previously the same popup was used to show a "new diff with the selected
arguments" and to "update the arguments used by the current diff", which
was rather confusing.  A bigger issue however is that in the former case
the arguments are not actually respected.  To make it easier to fix that
first remove the ability to do the latter.  Once the former has been
fixed, the functionality removed here will also be restored, but then
using a dedicated popup and new setter commands.
use a variety of variables to hold diff arguments

Use different variables for diff arguments depending on the mode.

In diff-only buffers (whose major-mode derives from `magit-diff-mode'),
continue to use `magit-diff-arguments'.  This _should_ then be used
to set the buffer-local value of `magit-refresh-args'.  But this is
currently not the case and won't be fixed until the next commit.

In also-diff buffers (which contain diffs but also other sections,
e.g. status buffers) we cannot use `magit-refresh-args' because
the diff sections would compete with other sections over who gets
to store their information in there.  So we use the new variable
`magit-diff-section-arguments'.

A later commit will add a new popup which actually allows changing the
value of either `magit-refresh-args' or `magit-diff-section-arguments'.

To make dealing with these complications easy add the new utility
functions `magit-diff-arguments' and `magit-diff-arguments-variable'.
respect arguments set in magit-diff-popup

Some time ago this broke and the arguments set in the popup were simply
ignored.  The last few commits improved how we deal with diff arguments,
now we also need to teach the diff commands to actually retrieve the
arguments from the popup (using `magit-current-popup-args') and then
use them when calling `git diff'.
add "-M" and "-C" to diff popup

Remove the variable `magit-diff-extra-options' which was always intended
as a kludge.  Instead make "-M" and "-C" available from the diff popup.

Do _not_ add these arguments to the popup default value or to that of
the variable `magit-diff-section-arguments'.  Note that these arguments
were _not_ previously used "by default", the were used unconditionally,
because there was no other way.  Enabling this by default isn't
desirable because it decreases performance.

Also use "--no-prefix" (which also was a member of the removed variable,
but unlike the other arguments is mandatory) explicitly where previously
the variable was used.
allow changing diff arguments used in current buffer

Add a new popup `magit-diff-refresh-popup' and a new command
`magit-diff-refresh' invoked from that popup, to allow changing the diff
arguments used in the current buffer.  In a diff buffer this changes the
value of `magit-refresh-args' and refreshes.  In other buffers which may
contain other things besides diffs change `magit-diff-section-arguments'
and refresh.

Also add `magit-diff-set-default-arguments' and
`magit-diff-save-default-arguments' which additionally set/save the
default value of the appropriate variable.  In diff buffers that is
`magit-diff-arguments', not `magit-refresh-args'.
magit-diff-dwim: new command

In the `magit-diff-popup' bind "d" to the new command, which means that
we can no longer use that for `magit-diff-unstaged'.  Instead "u" shows
unstaged changes and "s" shows changes, which by the way I intended to
do eventually every since I started using "d" and "i" for these
variants.

This also means that we have to rearrange the actions in the popup.
And that in turn is a good opportunity to also make `magit-stash-show'
available from this popup, allowing that command to take advantage
of its use of `magit-diff-arguments' in the `interactive' form added
in the previous commits.
Merge branch 'n/diff-args' into next