# HG changeset patch
# User David Pope <d.e.pope@gmail.com>
# Date 1333548641 14400
# Node ID cf6e51d14b1fd858dac1589ca69ff3a585693971
# Parent  2cfb68fa26cd10c54b17f833ba67e3f408c48ca4
Add 'diffprg' option, modeled after 'formatprg' and 'equalprg'.

diff -r 2cfb68fa26cd -r cf6e51d14b1f runtime/doc/options.txt
--- a/runtime/doc/options.txt	Wed Mar 28 20:51:51 2012 +0200
+++ b/runtime/doc/options.txt	Wed Apr 04 10:10:41 2012 -0400
@@ -2437,6 +2437,22 @@
 		:set diffopt=
 		:set diffopt=filler,foldcolumn:3
 <
+
+						*'diffprg'* *'dp'*
+'diffprg' 'dp'		string (default "")
+			global
+			{not in Vi}
+	The name of an external program that will be used to compare two
+	buffers.  The program must take the input on stdin and produce the
+	output on stdout.  The Unix program "diff" is such a program.
+	If the 'diffexpr' option is not empty it will be used instead.
+	Otherwise, if 'diffprg' option is an empty string, the internal
+	format function will be used |diff|.
+	Environment variables are expanded |:set_env|.  See |option-backslash|
+	about including spaces and backslashes.
+	The expression may be evaluated in the |sandbox|, see
+	|sandbox-option|.
+
 				     *'digraph'* *'dg'* *'nodigraph'* *'nodg'*
 'digraph' 'dg'		boolean	(default off)
 			global
diff -r 2cfb68fa26cd -r cf6e51d14b1f runtime/doc/tags
--- a/runtime/doc/tags	Wed Mar 28 20:51:51 2012 +0200
+++ b/runtime/doc/tags	Wed Apr 04 10:10:41 2012 -0400
@@ -183,11 +183,13 @@
 'diff'	options.txt	/*'diff'*
 'diffexpr'	options.txt	/*'diffexpr'*
 'diffopt'	options.txt	/*'diffopt'*
+'diffprg'	options.txt	/*'diffprg'*
 'digraph'	options.txt	/*'digraph'*
 'dip'	options.txt	/*'dip'*
 'dir'	options.txt	/*'dir'*
 'directory'	options.txt	/*'directory'*
 'display'	options.txt	/*'display'*
+'dp'	options.txt	/*'dp'*
 'dy'	options.txt	/*'dy'*
 'ea'	options.txt	/*'ea'*
 'ead'	options.txt	/*'ead'*
diff -r 2cfb68fa26cd -r cf6e51d14b1f src/diff.c
--- a/src/diff.c	Wed Mar 28 20:51:51 2012 +0200
+++ b/src/diff.c	Wed Apr 04 10:10:41 2012 -0400
@@ -836,7 +836,9 @@
 #endif
     {
 	len = STRLEN(tmp_orig) + STRLEN(tmp_new)
-				      + STRLEN(tmp_diff) + STRLEN(p_srr) + 27;
+			       + STRLEN(tmp_diff) + STRLEN(p_srr)
+			       + STRLEN((*p_dp == NUL ? "diff" : p_dp))
+			       + 27;
 	cmd = alloc((unsigned)len);
 	if (cmd != NULL)
 	{
@@ -847,7 +849,8 @@
 	    /* Build the diff command and execute it.  Always use -a, binary
 	     * differences are of no use.  Ignore errors, diff returns
 	     * non-zero when differences have been found. */
-	    vim_snprintf((char *)cmd, len, "diff %s%s%s%s%s %s",
+	    vim_snprintf((char *)cmd, len, "%s %s%s%s%s%s %s",
+		    *p_dp == NUL ? (char *)"diff" : (char *)p_dp,
 		    diff_a_works == FALSE ? "" : "-a ",
 #if defined(MSWIN) || defined(MSDOS)
 		    diff_bin_works == TRUE ? "--binary " : "",
diff -r 2cfb68fa26cd -r cf6e51d14b1f src/option.c
--- a/src/option.c	Wed Mar 28 20:51:51 2012 +0200
+++ b/src/option.c	Wed Apr 04 10:10:41 2012 -0400
@@ -1003,6 +1003,9 @@
 			    {(char_u *)"", (char_u *)NULL}
 #endif
 			    SCRIPTID_INIT},
+    {"diffprg",     "dp",   P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
+			    (char_u *)&p_dp, PV_NONE,
+			    {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
     {"digraph",	    "dg",   P_BOOL|P_VI_DEF|P_VIM,
 #ifdef FEAT_DIGRAPHS
 			    (char_u *)&p_dg, PV_NONE,
diff -r 2cfb68fa26cd -r cf6e51d14b1f src/option.h
--- a/src/option.h	Wed Mar 28 20:51:51 2012 +0200
+++ b/src/option.h	Wed Apr 04 10:10:41 2012 -0400
@@ -411,6 +411,7 @@
 #endif
 #ifdef FEAT_DIFF
 EXTERN char_u	*p_dip;		/* 'diffopt' */
+EXTERN char_u	*p_dp;		/* 'diffprg' */
 # ifdef FEAT_EVAL
 EXTERN char_u	*p_dex;		/* 'diffexpr' */
 # endif
exporting patch:
<fdopen>
