changeset 27495:b98c20b53a2d v8.2.4275

patch 8.2.4275: cannot use an autoload function from a package under start Commit: https://github.com/vim/vim/commit/223a950a85448253780da4e821a5b23dcdfad28f Author: =?UTF-8?q?Bj=C3=B6rn=20Linse?= <bjorn.linse@gmail.com> Date: Mon Jan 31 17:26:05 2022 +0000 patch 8.2.4275: cannot use an autoload function from a package under start Problem: Cannot use an autoload function from a package under start. Solution: Also look in the "start" package directory. (Bjorn Linse, closes #7193)
author Bram Moolenaar <Bram@vim.org>
date Mon, 31 Jan 2022 18:30:04 +0100
parents da0282e40477
children cd5a89c0e571
files src/scriptfile.c src/testdir/test_packadd.vim src/version.c
diffstat 3 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -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;
     }
 
--- a/src/testdir/test_packadd.vim
+++ b/src/testdir/test_packadd.vim
@@ -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'
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4275,
+/**/
     4274,
 /**/
     4273,