Fix usage of mapping.buf since it's update

This commit is contained in:
Walter Leibbrandt 2022-10-07 02:35:56 +02:00
parent d9e70aa52e
commit d8f9ac379c
2 changed files with 66 additions and 148 deletions

View File

@ -32,21 +32,14 @@
:on-result (output-expanded me-form)})))
(defn add-buf-mappings []
(mapping.buf :n nil "cm" ":ConjureCljMacroexpand<CR>")
(mapping.buf :n nil "c0" ":ConjureCljMacroexpand0<CR>")
(mapping.buf :n nil "c1" ":ConjureCljMacroexpand1<CR>"))
(mapping.buf :CljMacroexpand "cm" #(clj-macroexpand)
{:desc "Call macroexpand-all on the symbol under the cursor"})
(mapping.buf :CljMacroexpand0 "c0" #(clj-macroexpand "clojure.core/macroexpand")
{:desc "Call macroexpand on the symbol under the cursor"})
(mapping.buf :CljMacroexpand1 "c1" #(clj-macroexpand "clojure.core/macroexpand-1")
{:desc "Call macroexpand-1 on the symbol under the cursor"}))
(defn init []
(nvim.ex.command_
"ConjureCljMacroexpand"
(bridge.viml->lua :conjure-macroexpand.main :clj-macroexpand))
(nvim.ex.command_
"ConjureCljMacroexpand0"
(bridge.viml->lua :conjure-macroexpand.main :clj-macroexpand {:args "\"clojure.core/macroexpand\""}))
(nvim.ex.command_
"ConjureCljMacroexpand1"
(bridge.viml->lua :conjure-macroexpand.main :clj-macroexpand {:args "\"clojure.core/macroexpand-1\""}))
(when (or (not nvim.g.conjure_macroexpand_disable_mappings)
(= 0 nvim.g.conjure_macroexpand_disable_mappings))
(nvim.ex.autocmd

View File

@ -1,148 +1,73 @@
local _2afile_2a = "fnl/conjure-macroexpand/main.fnl"
local _0_
do
local name_0_ = "conjure-macroexpand.main"
local module_0_
do
local x_0_ = package.loaded[name_0_]
if ("table" == type(x_0_)) then
module_0_ = x_0_
else
module_0_ = {}
end
end
module_0_["aniseed/module"] = name_0_
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
do end (package.loaded)[name_0_] = module_0_
_0_ = module_0_
end
local autoload
local function _1_(...)
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
end
autoload = _1_
local function _2_(...)
local ok_3f_0_, val_0_ = nil, nil
local function _2_()
return {require("conjure-macroexpand.aniseed.core"), require("conjure.bridge"), require("conjure.client"), require("conjure.eval"), require("conjure.extract"), require("conjure.log"), require("conjure.mapping"), require("conjure-macroexpand.aniseed.nvim")}
end
ok_3f_0_, val_0_ = pcall(_2_)
if ok_3f_0_ then
_0_["aniseed/local-fns"] = {require = {a = "conjure-macroexpand.aniseed.core", bridge = "conjure.bridge", client = "conjure.client", eval = "conjure.eval", extract = "conjure.extract", log = "conjure.log", mapping = "conjure.mapping", nvim = "conjure-macroexpand.aniseed.nvim"}}
return val_0_
else
return print(val_0_)
end
end
local _local_0_ = _2_(...)
local a = _local_0_[1]
local bridge = _local_0_[2]
local client = _local_0_[3]
local eval = _local_0_[4]
local extract = _local_0_[5]
local log = _local_0_[6]
local mapping = _local_0_[7]
local nvim = _local_0_[8]
local _2amodule_2a = _0_
local _2amodule_name_2a = "conjure-macroexpand.main"
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
local current_form
local _2amodule_2a
do
local v_0_
local function current_form0()
local form = extract.form({})
if form then
local _let_0_ = form
local content = _let_0_["content"]
return content
end
end
v_0_ = current_form0
local t_0_ = (_0_)["aniseed/locals"]
t_0_["current-form"] = v_0_
current_form = v_0_
package.loaded[_2amodule_name_2a] = {}
_2amodule_2a = package.loaded[_2amodule_name_2a]
end
local clj_client
local _2amodule_locals_2a
do
local v_0_
local function clj_client0(f, args)
return client["with-filetype"]("clojure", f, args)
end
v_0_ = clj_client0
local t_0_ = (_0_)["aniseed/locals"]
t_0_["clj-client"] = v_0_
clj_client = v_0_
_2amodule_2a["aniseed/locals"] = {}
_2amodule_locals_2a = (_2amodule_2a)["aniseed/locals"]
end
local output_expanded
do
local v_0_
local function output_expanded0(orig)
local function _3_(r)
return log.append({("; " .. orig), r}, {["break?"] = true})
end
return _3_
local a, bridge, client, eval, extract, log, mapping, nvim = require("conjure-macroexpand.aniseed.core"), require("conjure.bridge"), require("conjure.client"), require("conjure.eval"), require("conjure.extract"), require("conjure.log"), require("conjure.mapping"), require("conjure-macroexpand.aniseed.nvim")
do end (_2amodule_locals_2a)["a"] = a
_2amodule_locals_2a["bridge"] = bridge
_2amodule_locals_2a["client"] = client
_2amodule_locals_2a["eval"] = eval
_2amodule_locals_2a["extract"] = extract
_2amodule_locals_2a["log"] = log
_2amodule_locals_2a["mapping"] = mapping
_2amodule_locals_2a["nvim"] = nvim
local function current_form()
local form = extract.form({})
if form then
local _let_1_ = form
local content = _let_1_["content"]
return content
else
return nil
end
v_0_ = output_expanded0
local t_0_ = (_0_)["aniseed/locals"]
t_0_["output-expanded"] = v_0_
output_expanded = v_0_
end
local clojure_macroexpand
do
local v_0_
do
local v_0_0
local function clojure_macroexpand0(expand_cmd)
local form = current_form()
local me_form = ("(" .. (expand_cmd or "clojure.walk/macroexpand-all") .. " '" .. form .. ")")
return clj_client(eval["eval-str"], {["on-result"] = output_expanded(me_form), ["passive?"] = true, code = me_form, origin = "conjure-macroexpand"})
end
v_0_0 = clojure_macroexpand0
_0_["clojure-macroexpand"] = v_0_0
v_0_ = v_0_0
_2amodule_locals_2a["current-form"] = current_form
local function clj_client(f, args)
return client["with-filetype"]("clojure", f, args)
end
_2amodule_locals_2a["clj-client"] = clj_client
local function output_expanded(orig)
local function _3_(r)
return log.append({("; " .. orig), r}, {["break?"] = true})
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["clojure-macroexpand"] = v_0_
clojure_macroexpand = v_0_
return _3_
end
local add_buf_mappings
do
local v_0_
do
local v_0_0
local function add_buf_mappings0()
mapping.buf("n", nil, "cm", ":ConjureCljMacroexpand<CR>")
mapping.buf("n", nil, "c0", ":ConjureCljMacroexpand0<CR>")
return mapping.buf("n", nil, "c1", ":ConjureCljMacroexpand1<CR>")
end
v_0_0 = add_buf_mappings0
_0_["add-buf-mappings"] = v_0_0
v_0_ = v_0_0
_2amodule_locals_2a["output-expanded"] = output_expanded
local function clj_macroexpand(expand_cmd)
local form = current_form()
local me_form = ("(" .. (expand_cmd or "clojure.walk/macroexpand-all") .. " '" .. form .. ")")
return clj_client(eval["eval-str"], {origin = "conjure-macroexpand", code = me_form, ["passive?"] = true, ["on-result"] = output_expanded(me_form)})
end
_2amodule_2a["clj-macroexpand"] = clj_macroexpand
local function add_buf_mappings()
local function _4_()
return clj_macroexpand()
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["add-buf-mappings"] = v_0_
add_buf_mappings = v_0_
end
local init
do
local v_0_
do
local v_0_0
local function init0()
nvim.ex.command_("ConjureCljMacroexpand", bridge["viml->lua"]("conjure-macroexpand.main", "clojure-macroexpand"))
nvim.ex.command_("ConjureCljMacroexpand0", bridge["viml->lua"]("conjure-macroexpand.main", "clojure-macroexpand", {args = "\"clojure.core/macroexpand\""}))
nvim.ex.command_("ConjureCljMacroexpand1", bridge["viml->lua"]("conjure-macroexpand.main", "clojure-macroexpand", {args = "\"clojure.core/macroexpand-1\""}))
if (not nvim.g.conjure_macroexpand_disable_mappings or (0 == nvim.g.conjure_macroexpand_disable_mappings)) then
return nvim.ex.autocmd("FileType", "clojure", bridge["viml->lua"]("conjure-macroexpand.main", "add-buf-mappings"))
end
end
v_0_0 = init0
_0_["init"] = v_0_0
v_0_ = v_0_0
mapping.buf("CljMacroexpand", "cm", _4_, {desc = "Call macroexpand-all on the symbol under the cursor"})
local function _5_()
return clj_macroexpand("clojure.core/macroexpand")
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["init"] = v_0_
init = v_0_
mapping.buf("CljMacroexpand0", "c0", _5_, {desc = "Call macroexpand on the symbol under the cursor"})
local function _6_()
return clj_macroexpand("clojure.core/macroexpand-1")
end
return mapping.buf("CljMacroexpand1", "c1", _6_, {desc = "Call macroexpand-1 on the symbol under the cursor"})
end
return nil
_2amodule_2a["add-buf-mappings"] = add_buf_mappings
local function init()
if (not nvim.g.conjure_macroexpand_disable_mappings or (0 == nvim.g.conjure_macroexpand_disable_mappings)) then
return nvim.ex.autocmd("FileType", "clojure", bridge["viml->lua"]("conjure-macroexpand.main", "add-buf-mappings"))
else
return nil
end
end
_2amodule_2a["init"] = init
return _2amodule_2a