diff src/ex_cmds2.c @ 15442:3e2e1608efa4 v8.1.0729

patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost commit https://github.com/vim/vim/commit/2b6185287adf53343ed5f49e967ae402c64063e4 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 12 13:26:03 2019 +0100 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 https://github.com/vim/vim/issues/3739)
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Jan 2019 13:30:07 +0100
parents d2a162896a2a
children 4880dc2ccc3f
line wrap: on
line diff
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -4360,6 +4360,7 @@ do_source(
 #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 @@ do_source(
 #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 @@ do_source(
     }
 #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 @@ almosttheend:
     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;