fennel-xl/project.fnl
Jeremy Penner 1bcea81f43 lite-xl 2.1 support, sort of (currently requires hack for luasocket)
some nrepl fixes, "project file" support for customizing lite-xl on a
per-project basis by loading a fennel file
2022-12-27 21:20:44 -05:00

26 lines
933 B
Fennel

(local core (require :core))
(local fennel (require :plugins.fennel-xl.fennel))
(fn load-fennel-project-file [dir]
(let [project-path (.. dir _G.PATHSEP "lite-xl-project.fnl")
fennel-path fennel.path]
(when (system.get_file_info project-path)
; temporarily allow importing project-local modules
(set fennel.path (.. fennel-path ";" project-path _G.PATHSEP "?.fnl;" project-path _G.PATHSEP "?" _G.PATHSEP "init.fnl"))
(fennel.dofile project-path)
(set fennel.path fennel-path))))
(let [run core.run]
(fn core.run [...]
; when a new lite-xl window opens with a project, on_enter_project is _not_ called
(core.try load-fennel-project-file core.project_dir)
(let [on-enter-project core.on_enter_project]
(fn core.on_enter_project [new-dir]
(on-enter-project new-dir)
(core.try load-fennel-project-file new-dir)))
(set core.run run)
(run ...)))
{}