Skip to content

Commit 1bdd426

Browse files
committed
patch 7.4.1478
Problem: ":loadplugin" doesn't take care of ftdetect files. Solution: Also load ftdetect scripts when appropriate.
1 parent b5760a1 commit 1bdd426

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

src/ex_cmds2.c

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,6 +3052,25 @@ do_in_runtimepath(
30523052
return do_in_path(p_rtp, name, all, callback, cookie);
30533053
}
30543054

3055+
/*
3056+
* Source filetype detection scripts, if filetype.vim was already done.
3057+
*/
3058+
static void
3059+
may_do_filetypes(char_u *pat)
3060+
{
3061+
char_u *cmd = vim_strsave((char_u *)"did_load_filetypes");
3062+
3063+
/* If runtime/filetype.vim wasn't loaded yet, the scripts will be found
3064+
* when it loads. */
3065+
if (cmd != NULL && eval_to_number(cmd) > 0)
3066+
{
3067+
do_cmdline_cmd((char_u *)"augroup filetypedetect");
3068+
source_runtime(pat, TRUE);
3069+
do_cmdline_cmd((char_u *)"augroup END");
3070+
}
3071+
vim_free(cmd);
3072+
}
3073+
30553074
static void
30563075
source_pack_plugin(char_u *fname, void *cookie UNUSED)
30573076
{
@@ -3122,6 +3141,7 @@ source_packages()
31223141
{
31233142
do_in_path(p_pp, (char_u *)"pack/*/ever/*/plugin/*.vim",
31243143
TRUE, source_pack_plugin, NULL);
3144+
may_do_filetypes((char_u *)"pack/*/ever/*/ftdetect/*.vim");
31253145
}
31263146

31273147
/*
@@ -3130,16 +3150,21 @@ source_packages()
31303150
void
31313151
ex_loadplugin(exarg_T *eap)
31323152
{
3133-
static char *pattern = "pack/*/opt/%s/plugin/*.vim";
3153+
static char *plugpat = "pack/*/opt/%s/plugin/*.vim";
3154+
static char *ftpat = "pack/*/opt/%s/ftdetect/*.vim";
31343155
int len;
31353156
char *pat;
31363157

3137-
len = (int)STRLEN(pattern) + (int)STRLEN(eap->arg);
3158+
len = (int)STRLEN(ftpat) + (int)STRLEN(eap->arg);
31383159
pat = (char *)alloc(len);
31393160
if (pat == NULL)
31403161
return;
3141-
vim_snprintf(pat, len, pattern, eap->arg);
3162+
vim_snprintf(pat, len, plugpat, eap->arg);
31423163
do_in_path(p_pp, (char_u *)pat, TRUE, source_pack_plugin, NULL);
3164+
3165+
vim_snprintf(pat, len, ftpat, eap->arg);
3166+
may_do_filetypes((char_u *)pat);
3167+
31433168
vim_free(pat);
31443169
}
31453170

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ static char *(features[]) =
743743

744744
static int included_patches[] =
745745
{ /* Add new patch number below this line */
746+
/**/
747+
1478,
746748
/**/
747749
1477,
748750
/**/

0 commit comments

Comments
 (0)