diff options
author | Frank Seifferth <frankseifferth@posteo.net> | 2023-10-08 13:05:37 +0200 |
---|---|---|
committer | Frank Seifferth <frankseifferth@posteo.net> | 2023-10-08 13:05:37 +0200 |
commit | a9c860befb75d0bc7a26840b65d9e6a4873ebbb8 (patch) | |
tree | c2957767d31abc9fea1b0e4e7a4aa27fdab9a617 | |
parent | c08d52fa67da259f07c56e6f82501e9d32515285 (diff) | |
download | vis-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.lua | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -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 |