patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost

Problem:    There is a SourcePre autocommand event but not a SourcePost.
Solution:   Add the SourcePost autocommand event. (closes #3739)
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 74d5642..4d48c1b 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -4360,6 +4360,7 @@
 #ifdef FEAT_PROFILE
     proftime_T		    wait_start;
 #endif
+    int			    trigger_source_post = FALSE;
 
     p = expand_env_save(fname);
     if (p == NULL)
@@ -4384,6 +4385,10 @@
 #else
 	retval = OK;
 #endif
+	if (retval == OK)
+	    // Apply SourcePost autocommands.
+	    apply_autocmds(EVENT_SOURCEPOST, fname_exp, fname_exp,
+								FALSE, curbuf);
 	goto theend;
     }
 
@@ -4653,6 +4658,9 @@
     }
 #endif
 
+    if (!got_int)
+	trigger_source_post = TRUE;
+
 #ifdef FEAT_EVAL
     /*
      * After a "finish" in debug mode, need to break at first command of next
@@ -4679,6 +4687,10 @@
     convert_setup(&cookie.conv, NULL, NULL);
 #endif
 
+    if (trigger_source_post)
+	apply_autocmds(EVENT_SOURCEPOST, si->sn_name, si->sn_name,
+								FALSE, curbuf);
+
 theend:
     vim_free(fname_exp);
     return retval;
diff --git a/src/fileio.c b/src/fileio.c
index fd8fd24..929cc15 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -7795,8 +7795,9 @@
     {"SessionLoadPost",	EVENT_SESSIONLOADPOST},
     {"ShellCmdPost",	EVENT_SHELLCMDPOST},
     {"ShellFilterPost",	EVENT_SHELLFILTERPOST},
-    {"SourcePre",	EVENT_SOURCEPRE},
     {"SourceCmd",	EVENT_SOURCECMD},
+    {"SourcePre",	EVENT_SOURCEPRE},
+    {"SourcePost",	EVENT_SOURCEPOST},
     {"SpellFileMissing",EVENT_SPELLFILEMISSING},
     {"StdinReadPost",	EVENT_STDINREADPOST},
     {"StdinReadPre",	EVENT_STDINREADPRE},
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 8db2995..8d83516 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -222,6 +222,7 @@
 	test_signs \
 	test_smartindent \
 	test_sort \
+	test_source \
 	test_source_utf8 \
 	test_spell \
 	test_startup \
@@ -376,6 +377,7 @@
 	test_shortpathname.res \
 	test_signs.res \
 	test_smartindent.res \
+	test_source.res \
 	test_spell.res \
 	test_startup.res \
 	test_stat.res \
diff --git a/src/testdir/test_source.vim b/src/testdir/test_source.vim
new file mode 100644
index 0000000..a33d286
--- /dev/null
+++ b/src/testdir/test_source.vim
@@ -0,0 +1,38 @@
+" Tests for the :source command.
+
+func Test_source_autocmd()
+  call writefile([
+	\ 'let did_source = 1',
+	\ ], 'Xsourced')
+  au SourcePre *source* let did_source_pre = 1
+  au SourcePost *source* let did_source_post = 1
+
+  source Xsourced
+
+  call assert_equal(g:did_source, 1)
+  call assert_equal(g:did_source_pre, 1)
+  call assert_equal(g:did_source_post, 1)
+
+  call delete('Xsourced')
+  au! SourcePre
+  au! SourcePost
+  unlet g:did_source
+  unlet g:did_source_pre
+  unlet g:did_source_post
+endfunc
+
+func Test_source_cmd()
+  au SourceCmd *source* let did_source = expand('<afile>')
+  au SourcePre *source* let did_source_pre = 2
+  au SourcePost *source* let did_source_post = 2
+
+  source Xsourced
+
+  call assert_equal(g:did_source, 'Xsourced')
+  call assert_false(exists('g:did_source_pre'))
+  call assert_equal(g:did_source_post, 2)
+
+  au! SourceCmd
+  au! SourcePre
+  au! SourcePost
+endfunc
diff --git a/src/version.c b/src/version.c
index 8ef6660..118a867 100644
--- a/src/version.c
+++ b/src/version.c
@@ -796,6 +796,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    729,
+/**/
     728,
 /**/
     727,
diff --git a/src/vim.h b/src/vim.h
index be86c6b..150f39c 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -1324,6 +1324,7 @@
     EVENT_SHELLFILTERPOST,	// after ":1,2!cmd", ":w !cmd", ":r !cmd".
     EVENT_SOURCECMD,		// sourcing a Vim script using command
     EVENT_SOURCEPRE,		// before sourcing a Vim script
+    EVENT_SOURCEPOST,		// after sourcing a Vim script
     EVENT_SPELLFILEMISSING,	// spell file missing
     EVENT_STDINREADPOST,	// after reading from stdin
     EVENT_STDINREADPRE,		// before reading from stdin