From 8cc90dcf33dd38d73dc9f173e200e05aa2c178c4 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 10 Aug 2021 20:38:41 -0700 Subject: [PATCH] tidy up add_to_config_reload_watch_list refs: #989 --- config/src/lib.rs | 19 +++++++++---------- config/src/lua.rs | 3 ++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/src/lib.rs b/config/src/lib.rs index 969b81d7e..e98c109e6 100644 --- a/config/src/lib.rs +++ b/config/src/lib.rs @@ -480,24 +480,23 @@ impl ConfigInner { self.generation += 1; let mut watch_paths = vec![]; + if let Some(path) = file_name { + watch_paths.push(path); + } + + // If we loaded a user config, publish this latest version of + // the lua state to the LUA_PIPE. This allows a subsequent + // call to `with_lua_config` to reference this lua context + // even though we are (probably) resolving this from a background + // reloading thread. if let Some(lua) = lua { ConfigInner::accumulate_watch_paths(&lua, &mut watch_paths); - // If we loaded a user config, publish this latest version of - // the lua state to the LUA_PIPE. This allows a subsequent - // call to `with_lua_config` to reference this lua context - // even though we are (probably) resolving this from a background - // reloading thread. LUA_PIPE.sender.try_send(lua).ok(); } log::debug!("Reloaded configuration! generation={}", self.generation); self.notify(); if self.config.automatically_reload_config { - if watch_paths.is_empty() { - if let Some(path) = file_name { - watch_paths.push(path); - } - } for path in watch_paths { self.watch_path(path); } diff --git a/config/src/lua.rs b/config/src/lua.rs index b1bc28eb0..c07582995 100644 --- a/config/src/lua.rs +++ b/config/src/lua.rs @@ -75,7 +75,6 @@ pub fn make_lua_context(config_file: &Path) -> anyhow::Result { .to_str() .ok_or_else(|| anyhow!("config file path is not UTF-8"))?; - lua.set_named_registry_value("wezterm-watch-paths", vec![config_file_str])?; wezterm_mod.set("config_file", config_file_str)?; wezterm_mod.set( "config_dir", @@ -83,6 +82,8 @@ pub fn make_lua_context(config_file: &Path) -> anyhow::Result { .to_str() .ok_or_else(|| anyhow!("config dir path is not UTF-8"))?, )?; + + lua.set_named_registry_value("wezterm-watch-paths", Vec::::new())?; wezterm_mod.set( "add_to_config_reload_watch_list", lua.create_function(|lua, args: Variadic| {