From a9c860befb75d0bc7a26840b65d9e6a4873ebbb8 Mon Sep 17 00:00:00 2001 From: Frank Seifferth Date: Sun, 8 Oct 2023 13:05:37 +0200 Subject: Set values on WIN_OPEN rather than FILE_OPEN This prepares the editorconfig plugin for upcoming changes in vis version 0.9. See the following two commits: https://github.com/martanne/vis/commit/450dc2df6a3b6443e372dc86cbefc8fede71b54d https://github.com/martanne/vis/commit/de315f878fba5b6abf2810a05995ae1f5b00d45d Thanks to Florian Fischer for bringing the issue to my attention. --- edconf.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/edconf.lua b/edconf.lua index cb92d54..4965537 100644 --- a/edconf.lua +++ b/edconf.lua @@ -183,22 +183,22 @@ local function ec_iter(p) end end -local function ec_set_values(file) - if file.path then - for name, value in ec_iter(file.path) do - if OPTIONS[name] then - OPTIONS[name](value, file) - end +local function ec_set_values(win) + if not win or not win.file or not win.file.path then return end + for name, value in ec_iter(win.file.path) do + if OPTIONS[name] then + OPTIONS[name](value, win.file) end end end + vis:command_register("econfig_parse", function() - ec_set_values(vis.win.file) + ec_set_values(vis.win) end, "(Re)parse an editorconfig file") -vis.events.subscribe(vis.events.FILE_OPEN, function (file) - ec_set_values(file) +vis.events.subscribe(vis.events.WIN_OPEN, function (win) + ec_set_values(win) end) return M -- cgit