Add lite command to unload macros
This commit is contained in:
parent
926d808a92
commit
f33b0cd695
17
wrap.fnl
17
wrap.fnl
|
@ -7,22 +7,31 @@
|
||||||
(local keymap (require :core.keymap))
|
(local keymap (require :core.keymap))
|
||||||
(local translate (require :core.doc.translate))
|
(local translate (require :core.doc.translate))
|
||||||
|
|
||||||
(command.add "core.docview" {
|
(fn get-modname []
|
||||||
"fennel:eval" #(editor.inline-eval #(fv (fennel.eval $1 {:env _G :compiler-env _G}) {}))
|
|
||||||
"lume:hotswap" (fn []
|
|
||||||
(local modname
|
|
||||||
(-> core.active_view.doc.filename
|
(-> core.active_view.doc.filename
|
||||||
(: :gsub "%.%a+$" "")
|
(: :gsub "%.%a+$" "")
|
||||||
(: :gsub "/" ".")
|
(: :gsub "/" ".")
|
||||||
(: :gsub "^data%." "")
|
(: :gsub "^data%." "")
|
||||||
(: :gsub "%.init$" "")))
|
(: :gsub "%.init$" "")))
|
||||||
|
|
||||||
|
(command.add "core.docview" {
|
||||||
|
"fennel:eval" #(editor.inline-eval #(fv (fennel.eval $1 {:env _G :compiler-env _G}) {}))
|
||||||
|
"lume:hotswap" (fn []
|
||||||
|
(local modname (get-modname))
|
||||||
(core.log (.. "Hotswapping " modname))
|
(core.log (.. "Hotswapping " modname))
|
||||||
(local (mod err) (util.hotswap modname))
|
(local (mod err) (util.hotswap modname))
|
||||||
(when (not= err nil) (print err) (error err)))
|
(when (not= err nil) (print err) (error err)))
|
||||||
|
"fennel:unload-macro" (fn []
|
||||||
|
(let [modname (get-modname)]
|
||||||
|
(if (. fennel.macro-loaded modname)
|
||||||
|
(do (core.log (.. "Unloading macro module " modname))
|
||||||
|
(tset fennel.macro-loaded modname nil))
|
||||||
|
(core.log (.. modname " was not a loaded macro module")))))
|
||||||
})
|
})
|
||||||
(keymap.add {
|
(keymap.add {
|
||||||
"alt+e" "fennel:eval"
|
"alt+e" "fennel:eval"
|
||||||
"alt+r" "lume:hotswap"
|
"alt+r" "lume:hotswap"
|
||||||
|
"alt+u" "fennel:unload-macro"
|
||||||
})
|
})
|
||||||
|
|
||||||
{}
|
{}
|
||||||
|
|
Loading…
Reference in a new issue