Patch 7.4.1550
Problem: Cannot load packages early.
Solution: Add the ":packloadall" command.
Files: src/ex_cmds.h, src/ex_cmds2.c, src/main.c,
src/proto/ex_cmds2.pro, src/testdir/test_packadd.vim
*** ../vim-7.4.1549/src/ex_cmds.h 2016-03-06 14:44:03.806733673 +0100
--- src/ex_cmds.h 2016-03-12 20:31:14.490353951 +0100
***************
*** 1014,1019 ****
--- 1014,1022 ----
EX(CMD_packadd, "packadd", ex_packadd,
BANG|FILE1|NEEDARG|TRLBAR|SBOXOK|CMDWIN,
ADDR_LINES),
+ EX(CMD_packloadall, "packloadall", ex_packloadall,
+ BANG|TRLBAR|SBOXOK|CMDWIN,
+ ADDR_LINES),
EX(CMD_pclose, "pclose", ex_pclose,
BANG|TRLBAR,
ADDR_LINES),
*** ../vim-7.4.1549/src/ex_cmds2.c 2016-03-09 22:18:52.162443013 +0100
--- src/ex_cmds2.c 2016-03-12 20:31:53.213948472 +0100
***************
*** 3189,3202 ****
vim_free(ffname);
}
/*
* Find plugins in the package directories and source them.
*/
void
! source_packages()
{
! do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR,
add_pack_plugin, p_pp);
}
/*
--- 3189,3209 ----
vim_free(ffname);
}
+ static int did_source_packages = FALSE;
+
/*
+ * ":packloadall"
* Find plugins in the package directories and source them.
*/
void
! ex_packloadall(exarg_T *eap)
{
! if (!did_source_packages || (eap != NULL && eap->forceit))
! {
! did_source_packages = TRUE;
! do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR,
add_pack_plugin, p_pp);
+ }
}
/*
*** ../vim-7.4.1549/src/main.c 2016-03-11 22:52:00.734438114 +0100
--- src/main.c 2016-03-12 19:53:02.506296398 +0100
***************
*** 634,640 ****
# endif
TIME_MSG("loading plugins");
! source_packages();
TIME_MSG("loading packages");
}
#endif
--- 634,640 ----
# endif
TIME_MSG("loading plugins");
! ex_packloadall(NULL);
TIME_MSG("loading packages");
}
#endif
*** ../vim-7.4.1549/src/proto/ex_cmds2.pro 2016-03-03 17:13:00.488910501
+0100
--- src/proto/ex_cmds2.pro 2016-03-12 19:49:14.620678580 +0100
***************
*** 62,69 ****
void ex_runtime(exarg_T *eap);
int source_runtime(char_u *name, int all);
int do_in_runtimepath(char_u *name, int all, void (*callback)(char_u *fname,
void *ck), void *cookie);
! void source_packages(void);
! void ex_loadplugin(exarg_T *eap);
void ex_packadd(exarg_T *eap);
void ex_options(exarg_T *eap);
void ex_source(exarg_T *eap);
--- 62,68 ----
void ex_runtime(exarg_T *eap);
int source_runtime(char_u *name, int all);
int do_in_runtimepath(char_u *name, int all, void (*callback)(char_u *fname,
void *ck), void *cookie);
! void ex_packloadall(exarg_T *eap);
void ex_packadd(exarg_T *eap);
void ex_options(exarg_T *eap);
void ex_source(exarg_T *eap);
*** ../vim-7.4.1549/src/testdir/test_packadd.vim 2016-03-06
14:44:03.810733631 +0100
--- src/testdir/test_packadd.vim 2016-03-12 20:33:57.692645196 +0100
***************
*** 80,82 ****
--- 80,99 ----
call assert_equal("packadd pluginC", li[2])
call assert_equal("packadd ", li[3])
endfunc
+
+ func Test_packloadall()
+ let plugindir = &packpath . '/pack/mine/start/foo/plugin'
+ call mkdir(plugindir, 'p')
+ call writefile(['let g:plugin_foo_number = 1234'], plugindir . '/bar.vim')
+ packloadall
+ call assert_equal(1234, g:plugin_foo_number)
+
+ " only works once
+ call writefile(['let g:plugin_bar_number = 4321'], plugindir . '/bar2.vim')
+ packloadall
+ call assert_false(exists('g:plugin_bar_number'))
+
+ " works when ! used
+ packloadall!
+ call assert_equal(4321, g:plugin_bar_number)
+ endfunc
*** ../vim-7.4.1549/src/version.c 2016-03-12 20:15:17.640358972 +0100
--- src/version.c 2016-03-12 20:24:23.230661800 +0100
***************
*** 745,746 ****
--- 745,748 ----
{ /* Add new patch number below this line */
+ /**/
+ 1550,
/**/
--
Tips for aliens in New York: Land anywhere. Central Park, anywhere.
No one will care or indeed even notice.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.