patch 9.1.0403: Vim9: not able to import file from start dir

Commit: 
https://github.com/vim/vim/commit/8c35c26c1f68950a75a1a93339410244fec23afc
Author: Yegappan Lakshmanan <yegap...@yahoo.com>
Date:   Fri May 10 13:10:54 2024 +0200

    patch 9.1.0403: Vim9: not able to import file from start dir
    
    Problem:  Vim9: not able to import file from start dir
              (Danielle McLean)
    Solution: Allow to import from start directory
              (Yegappan Lakshmanan)
    
    fixes: #13313
    closes: #14740
    
    Signed-off-by: Yegappan Lakshmanan <yegap...@yahoo.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/scriptfile.c b/src/scriptfile.c
index d5ec7cfdd..b6c66b7a4 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -682,7 +682,7 @@ find_script_in_rtp(char_u *name)
 {
     int sid = -1;
 
-    (void)do_in_path_and_pp(p_rtp, name, DIP_NOAFTER,
+    (void)do_in_path_and_pp(p_rtp, name, DIP_START | DIP_NOAFTER,
                                                   find_script_callback, &sid);
     return sid;
 }
diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim
index 94e0f34a3..61184a1f4 100644
--- a/src/testdir/test_vim9_import.vim
+++ b/src/testdir/test_vim9_import.vim
@@ -3283,4 +3283,32 @@ def Test_set_imported_class_member()
   v9.CheckScriptSuccess(lines)
 enddef
 
+" Test for using an imported function from the vimrc file.  The function is
+" defined in the 'start' directory of a package.
+def Test_import_from_vimrc()
+  mkdir('Ximport/pack/foobar/start/foo/autoload', 'pR')
+  var lines =<< trim END
+    vim9script
+    export def Foo()
+      writefile(['Foo called'], 'Xoutput.log')
+    enddef
+  END
+  writefile(lines, 'Ximport/pack/foobar/start/foo/autoload/foo.vim')
+  lines =<< trim END
+    vim9script
+    set packpath+=./Ximport
+    try
+      import autoload 'foo.vim'
+      foo.Foo()
+    catch
+      writefile(['Failed to import foo.vim'], 'Xoutput.log')
+    endtry
+    qall!
+  END
+  writefile(lines, 'Xvimrc', 'D')
+  g:RunVim([], [], '-u Xvimrc')
+  assert_equal(['Foo called'], readfile('Xoutput.log'))
+  delete('Xoutput.log')
+enddef
+
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
diff --git a/src/version.c b/src/version.c
index a8f47873f..954b747b5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    403,
 /**/
     402,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1s5ODZ-00AF3X-No%40256bit.org.

Raspunde prin e-mail lui