Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions fnl/thyme/wrapper/parinfer.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@

;; This lib is based on https://raw.githubusercontent.com/harrygallagher4/nvim-parinfer-rust/main/LICENSE.

(import-macros {: error-fmt} :thyme.macros)
(import-macros {: when-not : error-fmt} :thyme.macros)

(local ffi (require :ffi))
(local Path (require :thyme.util.path))
Expand Down Expand Up @@ -170,6 +170,10 @@
?val))

(fn collect-gvar-options []
(when-not vim.g.parinfer_loaded
;; Make sure all the parinfer's vim.g options are filled with the default
;; values at least.
(vim.cmd "runtime plugin/parinfer.vim"))
(collect [vim-var-suffix lib-opt-name (pairs vim-var-suffixes)]
(values lib-opt-name (vim-var->lib-opts (. vim.g vim-var-suffix)))))

Expand Down Expand Up @@ -226,7 +230,7 @@ Passed Options:
Parinfer Result:
%s"
(: :format text ;
(vim.inspect (or ?opts {})) ;
(vim.inspect options) ;
(vim.inspect result)))]
(error msg)))))

Expand Down
8 changes: 4 additions & 4 deletions lua/thyme/compiler/cache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ local function determine_lua_path(module_name)
return Path.join(lua_cache_prefix, lua_module_path)
end
local function clear_cache_21()
local case_4_
local _4_
local function _5_(_241)
return (".lua" == _241:sub(-4))
end
case_4_ = vim.fs.find(_5_, {type = "file", path = lua_cache_prefix})
if ((_G.type(case_4_) == "table") and (case_4_[1] == nil)) then
_4_ = vim.fs.find(_5_, {type = "file", path = lua_cache_prefix})
if ((_G.type(_4_) == "table") and (_4_[1] == nil)) then
return false
else
local _ = case_4_
local _ = _4_
hide_files_in_dir_21(lua_cache_prefix)
clear_module_map_files_21()
return true
Expand Down
10 changes: 5 additions & 5 deletions lua/thyme/config/fallback.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ local function display_example_config_21()
end
local function prompt_fallback_config_21()
display_example_config_21()
local case_3_ = vim.fn.confirm(("Missing %s. Copy the sane example config to %s?"):format(config_filename, vim.fn.stdpath("config")), "&No\n&yes", 1, "Warning")
if (case_3_ == 2) then
local _3_ = vim.fn.confirm(("Missing %s. Copy the sane example config to %s?"):format(config_filename, vim.fn.stdpath("config")), "&No\n&yes", 1, "Warning")
if (_3_ == 2) then
local config_root_dir = vim.fs.dirname(config_path)
vim.fn.mkdir(config_root_dir, "p")
return vim.cmd(("saveas " .. config_path))
else
local _ = case_3_
local case_4_ = vim.fn.confirm("Aborted proceeding with nvim-thyme. Exit?", "&No\n&yes", 1, "WarningMsg")
if (case_4_ == 2) then
local _ = _3_
local _4_ = vim.fn.confirm("Aborted proceeding with nvim-thyme. Exit?", "&No\n&yes", 1, "WarningMsg")
if (_4_ == 2) then
return os.exit(1)
else
return nil
Expand Down
8 changes: 4 additions & 4 deletions lua/thyme/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ local function read_config_with_backup_21(config_file_path)
local _
cache["evaluating?"] = true
_ = nil
local ok_3f, _3fresult
local ok_3f, _3fresult = nil, nil
if _3fconfig_code then
local function _7_()
return fennel.eval(_3fconfig_code, compiler_options)
Expand Down Expand Up @@ -119,11 +119,11 @@ local function _15_(_self, k)
else
local _ = k
local config = get_config()
local case_17_ = default_opts[k]
if (case_17_ == nil) then
local _17_ = default_opts[k]
if (_17_ == nil) then
return error(("unexpected option detected: " .. k))
else
local _0 = case_17_
local _0 = _17_
return config[k]
end
end
Expand Down
26 changes: 13 additions & 13 deletions lua/thyme/dependency/logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ ModuleMapLogger["log-module-map!"] = function(self, dependency_stackframe, depen
local dependency_fnl_path = dependency_stackframe["get-fnl-path"](dependency_stackframe)
local module_map
do
local case_4_ = ModuleMap["try-read-from-file"](dependency_fnl_path)
if (case_4_ == nil) then
local _4_ = ModuleMap["try-read-from-file"](dependency_fnl_path)
if (_4_ == nil) then
local tgt_5_ = ModuleMap.new(dependency_stackframe)
module_map = (tgt_5_)["write-file!"](tgt_5_)
elseif (nil ~= case_4_) then
local map = case_4_
elseif (nil ~= _4_) then
local map = _4_
if (map["macro?"](map) and dependency_stackframe["get-lua-path"](dependency_stackframe)) then
local tgt_6_ = ModuleMap.new(dependency_stackframe)
module_map = (tgt_6_)["write-file!"](tgt_6_)
Expand All @@ -32,9 +32,9 @@ ModuleMapLogger["log-module-map!"] = function(self, dependency_stackframe, depen
end
self["_module-name->fnl-path"]["insert!"](self["_module-name->fnl-path"], dependency_stackframe["module-name"], dependency_stackframe["fnl-path"])
self["_fnl-path->module-map"]["insert!"](self["_fnl-path->module-map"], dependency_stackframe["fnl-path"], module_map)
local case_9_ = dependent_callstack[#dependent_callstack]
if (nil ~= case_9_) then
local dependent_stackframe = case_9_
local _9_ = dependent_callstack[#dependent_callstack]
if (nil ~= _9_) then
local dependent_stackframe = _9_
return module_map["log-dependent!"](module_map, dependent_stackframe)
else
return nil
Expand All @@ -43,9 +43,9 @@ end
ModuleMapLogger["fnl-path->module-map"] = function(self, raw_fnl_path)
local or_11_ = self["_fnl-path->module-map"]:get(raw_fnl_path)
if not or_11_ then
local case_12_ = ModuleMap["try-read-from-file"](raw_fnl_path)
if (nil ~= case_12_) then
local modmap = case_12_
local _12_ = ModuleMap["try-read-from-file"](raw_fnl_path)
if (nil ~= _12_) then
local modmap = _12_
self["_fnl-path->module-map"]["insert!"](self["_fnl-path->module-map"], raw_fnl_path, modmap)
or_11_ = modmap
else
Expand All @@ -67,9 +67,9 @@ ModuleMapLogger["fnl-path->module-name"] = function(self, raw_fnl_path)
end
end
ModuleMapLogger["module-name->module-map"] = function(self, module_name)
local case_17_ = self["module-name->fnl-path"](self, module_name)
if (nil ~= case_17_) then
local fnl_path = case_17_
local _17_ = self["module-name->fnl-path"](self, module_name)
if (nil ~= _17_) then
local fnl_path = _17_
return self["_fnl-path->module-map"]:get(fnl_path)
else
return nil
Expand Down
10 changes: 5 additions & 5 deletions lua/thyme/dependency/observer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Observer["observe!"] = function(self, callback, fnl_path, _3flua_path, compiler_
self.callstack["push!"](self.callstack, stackframe)
compiler_options["module-name"] = module_name
compiler_options.filename = fnl_path
local ok_3f, result
local ok_3f, result = nil, nil
local function _3_()
return callback(new_fnl_code, compiler_options, module_name)
end
Expand All @@ -42,12 +42,12 @@ Observer["observed?"] = function(self, module_name)
return (nil ~= self["module-name->stackframe"][module_name])
end
Observer["log-dependent!"] = function(self, module_name)
local case_5_ = self["module-name->stackframe"][module_name]
if (nil ~= case_5_) then
local stackframe = case_5_
local _5_ = self["module-name->stackframe"][module_name]
if (nil ~= _5_) then
local stackframe = _5_
return DependencyLogger["log-module-map!"](DependencyLogger, stackframe, self.callstack:get())
else
local _ = case_5_
local _ = _5_
return error(("the module " .. module_name .. " is not logged yet."))
end
end
Expand Down
4 changes: 2 additions & 2 deletions lua/thyme/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ local function propagate_underscored_keys_21(tbl, key)
end
else
end
local case_16_ = type(val)
if (case_16_ == "table") then
local _16_ = type(val)
if (_16_ == "table") then
for k in pairs(val) do
propagate_underscored_keys_21(val, k)
end
Expand Down
26 changes: 13 additions & 13 deletions lua/thyme/loader/fennel-module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ end
local function locate_fennel_path_21()
local _9_
do
local case_8_ = vim.api.nvim_get_runtime_file("fennel.lua", false)
if ((_G.type(case_8_) == "table") and (nil ~= case_8_[1])) then
local fennel_lua_path = case_8_[1]
local _8_ = vim.api.nvim_get_runtime_file("fennel.lua", false)
if ((_G.type(_8_) == "table") and (nil ~= _8_[1])) then
local fennel_lua_path = _8_[1]
_9_ = fennel_lua_path
elseif ((_G.type(case_8_) == "table") and (case_8_[1] == nil)) then
elseif ((_G.type(_8_) == "table") and (_8_[1] == nil)) then
_9_ = false
else
_9_ = nil
Expand All @@ -58,12 +58,12 @@ local function locate_fennel_path_21()
local or_13_ = _9_
if not or_13_ then
local rtp = vim.api.nvim_get_option_value("rtp", {})
local case_15_ = (rtp:match(Path.join("([^,]+", "fennel),")) or rtp:match(Path.join("([^,]+", "fennel)$")))
if (nil ~= case_15_) then
local fennel_repo_path = case_15_
local _15_ = (rtp:match(Path.join("([^,]+", "fennel),")) or rtp:match(Path.join("([^,]+", "fennel)$")))
if (nil ~= _15_) then
local fennel_repo_path = _15_
or_13_ = compile_fennel_into_rtp_21(fennel_repo_path)
else
local _ = case_15_
local _ = _15_
or_13_ = error("No `fennel.lua`, no `fennel`, and no Fennel repo found.\nPlease make sure to add the path to fennel repo in `&runtimepath`, or install a `fennel` executable.")
end
end
Expand All @@ -87,14 +87,14 @@ local function cache_fennel_lua_21(fennel_lua_path)
end
local function load_fennel(fennel_lua_path)
local cached_fennel_path = cache_fennel_lua_21(fennel_lua_path)
local case_22_, case_23_ = loadfile(cached_fennel_path)
if ((case_22_ == false) and (nil ~= case_23_)) then
local err_msg = case_23_
local _22_, _23_ = loadfile(cached_fennel_path)
if ((_22_ == false) and (nil ~= _23_)) then
local err_msg = _23_
local msg = LoaderMessenger["mk-failure-reason"](LoaderMessenger, ("Failed to load fennel.lua.\nError Message:\n%s\nContents:\n%s"):format(err_msg, read_file(cached_fennel_path)))
fs.unlink(cached_fennel_path)
return msg
elseif (nil ~= case_22_) then
local lua_chunk = case_22_
elseif (nil ~= _22_) then
local lua_chunk = _22_
return lua_chunk
else
return nil
Expand Down
Loading
Loading