Skip to content

Commit

Permalink
patch 8.2.4275: cannot use an autoload function from a package under …
Browse files Browse the repository at this point in the history
…start

Problem:    Cannot use an autoload function from a package under start.
Solution:   Also look in the "start" package directory. (Bjorn Linse,
            closes #7193)
  • Loading branch information
bfredl authored and brammool committed Jan 31, 2022
1 parent c570e9c commit 223a950
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/scriptfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2294,7 +2294,7 @@ script_autoload(

// Try loading the package from $VIMRUNTIME/autoload/<name>.vim
// Use "ret_sid" to avoid loading the same script again.
if (source_in_path(p_rtp, scriptname, 0, &ret_sid) == OK)
if (source_in_path(p_rtp, scriptname, DIP_START, &ret_sid) == OK)
ret = TRUE;
}

Expand Down
13 changes: 13 additions & 0 deletions src/testdir/test_packadd.vim
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,19 @@ func Test_packloadall()
call assert_equal(4321, g:plugin_bar_number)
endfunc

func Test_start_autoload()
" plugin foo with an autoload directory
let autodir = &packpath .. '/pack/mine/start/foo/autoload'
call mkdir(autodir, 'p')
let fname = autodir .. '/foobar.vim'
call writefile(['func foobar#test()',
\ ' return 1666',
\ 'endfunc'], fname)

call assert_equal(1666, foobar#test())
call delete(fname)
endfunc

func Test_helptags()
let docdir1 = &packpath . '/pack/mine/start/foo/doc'
let docdir2 = &packpath . '/pack/mine/start/bar/doc'
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4275,
/**/
4274,
/**/
Expand Down

0 comments on commit 223a950

Please sign in to comment.