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;