To: vim_dev@googlegroups.com Subject: Patch 7.4.1478 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1478 Problem: ":loadplugin" doesn't take care of ftdetect files. Solution: Also load ftdetect scripts when appropriate. Files: src/ex_cmds2.c *** ../vim-7.4.1477/src/ex_cmds2.c 2016-03-03 12:22:48.562554007 +0100 --- src/ex_cmds2.c 2016-03-03 14:21:48.955797583 +0100 *************** *** 3052,3057 **** --- 3052,3076 ---- return do_in_path(p_rtp, name, all, callback, cookie); } + /* + * Source filetype detection scripts, if filetype.vim was already done. + */ + static void + may_do_filetypes(char_u *pat) + { + char_u *cmd = vim_strsave((char_u *)"did_load_filetypes"); + + /* If runtime/filetype.vim wasn't loaded yet, the scripts will be found + * when it loads. */ + if (cmd != NULL && eval_to_number(cmd) > 0) + { + do_cmdline_cmd((char_u *)"augroup filetypedetect"); + source_runtime(pat, TRUE); + do_cmdline_cmd((char_u *)"augroup END"); + } + vim_free(cmd); + } + static void source_pack_plugin(char_u *fname, void *cookie UNUSED) { *************** *** 3122,3127 **** --- 3141,3147 ---- { do_in_path(p_pp, (char_u *)"pack/*/ever/*/plugin/*.vim", TRUE, source_pack_plugin, NULL); + may_do_filetypes((char_u *)"pack/*/ever/*/ftdetect/*.vim"); } /* *************** *** 3130,3145 **** void ex_loadplugin(exarg_T *eap) { ! static char *pattern = "pack/*/opt/%s/plugin/*.vim"; int len; char *pat; ! len = (int)STRLEN(pattern) + (int)STRLEN(eap->arg); pat = (char *)alloc(len); if (pat == NULL) return; ! vim_snprintf(pat, len, pattern, eap->arg); do_in_path(p_pp, (char_u *)pat, TRUE, source_pack_plugin, NULL); vim_free(pat); } --- 3150,3170 ---- void ex_loadplugin(exarg_T *eap) { ! static char *plugpat = "pack/*/opt/%s/plugin/*.vim"; ! static char *ftpat = "pack/*/opt/%s/ftdetect/*.vim"; int len; char *pat; ! len = (int)STRLEN(ftpat) + (int)STRLEN(eap->arg); pat = (char *)alloc(len); if (pat == NULL) return; ! vim_snprintf(pat, len, plugpat, eap->arg); do_in_path(p_pp, (char_u *)pat, TRUE, source_pack_plugin, NULL); + + vim_snprintf(pat, len, ftpat, eap->arg); + may_do_filetypes((char_u *)pat); + vim_free(pat); } *** ../vim-7.4.1477/src/version.c 2016-03-03 13:10:41.052418112 +0100 --- src/version.c 2016-03-03 14:06:41.945218029 +0100 *************** *** 745,746 **** --- 745,748 ---- { /* Add new patch number below this line */ + /**/ + 1478, /**/ -- BLACK KNIGHT: I'm invincible! ARTHUR: You're a looney. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///