From e797d0658c70c734485f54e070cc7300dc47db57 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 13 Jul 2020 17:20:22 -0400 Subject: fix: runtimepath always updates lua package.path --- src/nvim/lua/executor.c | 8 ++++++++ src/nvim/option.c | 5 +++++ 2 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 0d5622f1e7..86da517685 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -543,6 +543,14 @@ static lua_State *nlua_enter(void) return lstate; } +/// Force an update of lua's package paths if runtime path has changed. +bool nlua_update_package_path(void) +{ + lua_State *const lstate = nlua_enter(); + + return !!lstate; +} + static void nlua_print_event(void **argv) { char *str = argv[0]; diff --git a/src/nvim/option.c b/src/nvim/option.c index 2862419177..168160834b 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -80,6 +80,7 @@ #ifdef WIN32 # include "nvim/os/pty_conpty_win.h" #endif +#include "nvim/lua/executor.h" #include "nvim/api/private/helpers.h" #include "nvim/os/input.h" #include "nvim/os/lang.h" @@ -3344,6 +3345,10 @@ ambw_end: if (!parse_winhl_opt(curwin)) { errmsg = e_invarg; } + } else if (varp == &p_rtp) { // 'runtimepath' + if (!nlua_update_package_path()) { + errmsg = (char_u *)N_("E970: Failed to initialize lua interpreter"); + } } else { // Options that are a list of flags. p = NULL; -- cgit