Merge pull request #34 from budRich/user-module-auto-reload2
User module auto reload
This commit is contained in:
commit
1decf67b64
|
@ -107,12 +107,6 @@ command.add(nil, {
|
||||||
["core:open-user-module"] = function()
|
["core:open-user-module"] = function()
|
||||||
local user_module_doc = core.open_doc(USERDIR .. "/init.lua")
|
local user_module_doc = core.open_doc(USERDIR .. "/init.lua")
|
||||||
if not user_module_doc then return end
|
if not user_module_doc then return end
|
||||||
local doc_save = user_module_doc.save
|
|
||||||
user_module_doc.save = function(self)
|
|
||||||
doc_save(self)
|
|
||||||
core.reload_module("core.style")
|
|
||||||
core.load_user_directory()
|
|
||||||
end
|
|
||||||
core.root_view:open_doc(user_module_doc)
|
core.root_view:open_doc(user_module_doc)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,10 @@ end
|
||||||
|
|
||||||
local function save(filename)
|
local function save(filename)
|
||||||
doc():save(filename)
|
doc():save(filename)
|
||||||
|
if doc().filename == (USERDIR .. PATHSEP .. "init.lua") then
|
||||||
|
core.reload_module("core.style")
|
||||||
|
core.load_user_directory()
|
||||||
|
end
|
||||||
core.log("Saved \"%s\"", doc().filename)
|
core.log("Saved \"%s\"", doc().filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue