aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Seifferth <frankseifferth@posteo.net>2023-10-08 13:05:37 +0200
committerFrank Seifferth <frankseifferth@posteo.net>2023-10-08 13:05:37 +0200
commita9c860befb75d0bc7a26840b65d9e6a4873ebbb8 (patch)
treec2957767d31abc9fea1b0e4e7a4aa27fdab9a617
parentc08d52fa67da259f07c56e6f82501e9d32515285 (diff)
downloadvis-editorconfig-a9c860befb75d0bc7a26840b65d9e6a4873ebbb8.tar.gz
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.
-rw-r--r--edconf.lua18
1 files 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