Patch 8.0.1398
Problem: :packadd does not load packages from the "start" directory.
(Alejandro Hernandez)
Solution: Make :packadd look in the "start" directory if those packages were
not loaded on startup.
Files: src/ex_cmds2.c, src/testdir/test_packadd.vim
*** ../vim-8.0.1397/src/ex_cmds2.c 2017-12-05 16:46:21.070478039 +0100
--- src/ex_cmds2.c 2017-12-17 14:15:59.218669996 +0100
***************
*** 3747,3764 ****
void
ex_packadd(exarg_T *eap)
{
! static char *plugpat = "pack/*/opt/%s";
int len;
char *pat;
! len = (int)STRLEN(plugpat) + (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, DIP_ALL + DIP_DIR + DIP_ERR,
! add_pack_plugin, eap->forceit ? &APP_ADD_DIR : &APP_BOTH);
! vim_free(pat);
}
#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD)
--- 3747,3777 ----
void
ex_packadd(exarg_T *eap)
{
! static char *plugpat = "pack/*/%s/%s";
int len;
char *pat;
+ int round;
+ int res = OK;
! /* Round 1: use "start", round 2: use "opt". */
! for (round = 1; round <= 2; ++round)
! {
! /* Only look under "start" when loading packages wasn't done yet. */
! if (round == 1 && did_source_packages)
! continue;
!
! len = (int)STRLEN(plugpat) + (int)STRLEN(eap->arg) + 5;
! pat = (char *)alloc(len);
! if (pat == NULL)
! return;
! vim_snprintf(pat, len, plugpat, round == 1 ? "start" : "opt", eap->arg);
! /* The first round don't give a "not found" error, in the second round
! * only when nothing was found in the first round. */
! res = do_in_path(p_pp, (char_u *)pat,
! DIP_ALL + DIP_DIR + (round == 2 && res == FAIL ? DIP_ERR : 0),
! add_pack_plugin, eap->forceit ? &APP_ADD_DIR : &APP_BOTH);
! vim_free(pat);
! }
}
#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD)
*** ../vim-8.0.1397/src/testdir/test_packadd.vim 2017-10-27
00:54:59.146125099 +0200
--- src/testdir/test_packadd.vim 2017-12-17 14:22:33.516081002 +0100
***************
*** 45,50 ****
--- 45,68 ----
call assert_fails("packadd", 'E471:')
endfunc
+ func Test_packadd_start()
+ let plugdir = s:topdir . '/pack/mine/start/other'
+ call mkdir(plugdir . '/plugin', 'p')
+ set rtp&
+ let rtp = &rtp
+ filetype on
+
+ exe 'split ' . plugdir . '/plugin/test.vim'
+ call setline(1, 'let g:plugin_works = 24')
+ wq
+
+ packadd other
+
+ call assert_equal(24, g:plugin_works)
+ call assert_true(len(&rtp) > len(rtp))
+ call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/start/other\($\|,\)')
+ endfunc
+
func Test_packadd_noload()
call mkdir(s:plugdir . '/plugin', 'p')
call mkdir(s:plugdir . '/syntax', 'p')
*** ../vim-8.0.1397/src/version.c 2017-12-16 19:59:30.559719124 +0100
--- src/version.c 2017-12-17 14:12:07.412202520 +0100
***************
*** 773,774 ****
--- 773,776 ----
{ /* Add new patch number below this line */
+ /**/
+ 1398,
/**/
--
FIXME and XXX are two common keywords used to mark broken or incomplete code
not only since XXX as a sex reference would grab everybody's attention but
simply due to the fact that Vim would highlight these words.
-- Hendrik Scholz
/// 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.