Add lite command to unload macros
This commit is contained in:
parent
926d808a92
commit
f33b0cd695
21
wrap.fnl
21
wrap.fnl
|
@ -7,22 +7,31 @@
|
|||
(local keymap (require :core.keymap))
|
||||
(local translate (require :core.doc.translate))
|
||||
|
||||
(fn get-modname []
|
||||
(-> core.active_view.doc.filename
|
||||
(: :gsub "%.%a+$" "")
|
||||
(: :gsub "/" ".")
|
||||
(: :gsub "^data%." "")
|
||||
(: :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
|
||||
(-> core.active_view.doc.filename
|
||||
(: :gsub "%.%a+$" "")
|
||||
(: :gsub "/" ".")
|
||||
(: :gsub "^data%." "")
|
||||
(: :gsub "%.init$" "")))
|
||||
(local modname (get-modname))
|
||||
(core.log (.. "Hotswapping " modname))
|
||||
(local (mod err) (util.hotswap modname))
|
||||
(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 {
|
||||
"alt+e" "fennel:eval"
|
||||
"alt+r" "lume:hotswap"
|
||||
"alt+u" "fennel:unload-macro"
|
||||
})
|
||||
|
||||
{}
|
||||
|
|
Loading…
Reference in a new issue