]> granicus.if.org Git - vim/commitdiff
patch 8.2.4275: cannot use an autoload function from a package under start v8.2.4275
author=?UTF-8?q?Bj=C3=B6rn=20Linse?= <bjorn.linse@gmail.com>
Mon, 31 Jan 2022 17:26:05 +0000 (17:26 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 31 Jan 2022 17:26:05 +0000 (17:26 +0000)
Problem:    Cannot use an autoload function from a package under start.
Solution:   Also look in the "start" package directory. (Bjorn Linse,
            closes #7193)

src/scriptfile.c
src/testdir/test_packadd.vim
src/version.c

index dec512a72ba133196269102a65cb393db7e2a02a..cee3f5440b6887b1dc210cbc58e9ebe12649c1cd 100644 (file)
@@ -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;
     }
 
index d7a38daf311e62c25bc2cb9c2c2d2a70493787e1..8ca9b41a28d3b87ea1c8606e99d55e6b1bb80d2c 100644 (file)
@@ -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'
index 921f076727bf0dcceaaa08ab983ba38bc5c2d2ca..d3b7bf846192a5d276cfc67987c1f40b069a14b0 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4275,
 /**/
     4274,
 /**/