diff --git a/fnl/thyme/wrapper/parinfer.fnl b/fnl/thyme/wrapper/parinfer.fnl index 0b8cf252..d5c4b898 100644 --- a/fnl/thyme/wrapper/parinfer.fnl +++ b/fnl/thyme/wrapper/parinfer.fnl @@ -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)) @@ -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))))) @@ -226,7 +230,7 @@ Passed Options: Parinfer Result: %s" (: :format text ; - (vim.inspect (or ?opts {})) ; + (vim.inspect options) ; (vim.inspect result)))] (error msg))))) diff --git a/lua/thyme/compiler/cache.lua b/lua/thyme/compiler/cache.lua index 6cf3f860..bbceae6c 100644 --- a/lua/thyme/compiler/cache.lua +++ b/lua/thyme/compiler/cache.lua @@ -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 diff --git a/lua/thyme/config/fallback.lua b/lua/thyme/config/fallback.lua index a55bf7d0..533da3c1 100644 --- a/lua/thyme/config/fallback.lua +++ b/lua/thyme/config/fallback.lua @@ -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 diff --git a/lua/thyme/config/init.lua b/lua/thyme/config/init.lua index 37c0edee..7b66e94b 100644 --- a/lua/thyme/config/init.lua +++ b/lua/thyme/config/init.lua @@ -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) @@ -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 diff --git a/lua/thyme/dependency/logger.lua b/lua/thyme/dependency/logger.lua index 57d9a7aa..6d4aa4d5 100644 --- a/lua/thyme/dependency/logger.lua +++ b/lua/thyme/dependency/logger.lua @@ -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_) @@ -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 @@ -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 @@ -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 diff --git a/lua/thyme/dependency/observer.lua b/lua/thyme/dependency/observer.lua index 45da41cd..6923d3ea 100644 --- a/lua/thyme/dependency/observer.lua +++ b/lua/thyme/dependency/observer.lua @@ -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 @@ -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 diff --git a/lua/thyme/init.lua b/lua/thyme/init.lua index a57e8348..5239955b 100644 --- a/lua/thyme/init.lua +++ b/lua/thyme/init.lua @@ -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 diff --git a/lua/thyme/loader/fennel-module.lua b/lua/thyme/loader/fennel-module.lua index 445ab1a4..c60beaf7 100644 --- a/lua/thyme/loader/fennel-module.lua +++ b/lua/thyme/loader/fennel-module.lua @@ -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 @@ -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 @@ -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 diff --git a/lua/thyme/loader/macro-module.lua b/lua/thyme/loader/macro-module.lua index dc07b000..96587c18 100644 --- a/lua/thyme/loader/macro-module.lua +++ b/lua/thyme/loader/macro-module.lua @@ -12,9 +12,9 @@ local MacroRollbackManager = RollbackManager.new("macro", ".fnl") local cache = {["macro-loaded"] = {}, ["__macro-loaded"] = {}, ["mounted-rollback-searcher"] = nil} local function overwrite_metatable_21(original_table, cache_table) do - local case_3_ = getmetatable(original_table) - if (nil ~= case_3_) then - local mt = case_3_ + local _3_ = getmetatable(original_table) + if (nil ~= _3_) then + local mt = _3_ setmetatable(cache_table, mt) else end @@ -29,9 +29,9 @@ local function overwrite_metatable_21(original_table, cache_table) end end local function _7_(_, module_name) - local case_8_ = cache_table[module_name] - if (nil ~= case_8_) then - local cached = case_8_ + local _8_ = cache_table[module_name] + if (nil ~= _8_) then + local cached = _8_ Observer["log-dependent!"](Observer, module_name) return cached else @@ -46,9 +46,9 @@ local function macro_module__3e_3fchunk(module_name, fnl_path) local compiler_options = Config["compiler-options"] local _3fenv = compiler_options.env compiler_options.env = "_COMPILER" - local case_10_, case_11_ = Observer["observe!"](Observer, fennel.eval, fnl_path, nil, compiler_options, module_name) - if ((case_10_ == true) and (nil ~= case_11_)) then - local result = case_11_ + local _10_, _11_ = Observer["observe!"](Observer, fennel.eval, fnl_path, nil, compiler_options, module_name) + if ((_10_ == true) and (nil ~= _11_)) then + local result = _11_ local backup_handler = MacroRollbackManager["backup-handler-of"](MacroRollbackManager, module_name) local backup_path = backup_handler["determine-active-backup-path"](backup_handler) if ((fnl_path ~= backup_path) and backup_handler["should-update-backup?"](backup_handler, read_file(fnl_path))) then @@ -61,11 +61,11 @@ local function macro_module__3e_3fchunk(module_name, fnl_path) return result end return _13_ - elseif (true and (nil ~= case_11_)) then - local _ = case_10_ - local raw_msg = case_11_ + elseif (true and (nil ~= _11_)) then + local _ = _10_ + local raw_msg = _11_ local raw_msg_body = ("%s is found for the macro/%s, but failed to evaluate it in a compiler environment"):format(fnl_path, module_name) - local msg = MacroLoaderMessenger["mk-failure-reason"](MacroLoaderMessenger, ("%s\n\t%s"):format(raw_msg_body, raw_msg)) + local msg = MacroLoaderMessenger["mk-failure-reason"](MacroLoaderMessenger, ("%s\n %s"):format(raw_msg_body, raw_msg)) compiler_options.env = _3fenv return nil, msg else @@ -74,80 +74,80 @@ local function macro_module__3e_3fchunk(module_name, fnl_path) end local function search_fnl_macro_on_rtp_21(module_name) local fennel = require("fennel") - local case_15_ + local _15_ if cache["mounted-rollback-searcher"] then - case_15_ = cache["mounted-rollback-searcher"](module_name) + _15_ = cache["mounted-rollback-searcher"](module_name) else local macro_file_loader local function _16_(fnl_path, module_name0) return macro_module__3e_3fchunk(module_name0, fnl_path) end macro_file_loader = _16_ - local case_17_ = MacroRollbackManager["inject-mounted-backup-searcher!"](MacroRollbackManager, fennel["macro-searchers"], macro_file_loader) - if (nil ~= case_17_) then - local searcher = case_17_ + local _17_ = MacroRollbackManager["inject-mounted-backup-searcher!"](MacroRollbackManager, fennel["macro-searchers"], macro_file_loader) + if (nil ~= _17_) then + local searcher = _17_ validate_type("function", searcher) cache["mounted-rollback-searcher"] = searcher - case_15_ = searcher(module_name) + _15_ = searcher(module_name) else - case_15_ = nil + _15_ = nil end end - if (nil ~= case_15_) then - local chunk = case_15_ + if (nil ~= _15_) then + local chunk = _15_ return chunk else - local _ = case_15_ - local case_20_, case_21_ + local _ = _15_ + local _20_, _21_ = nil, nil do - local case_22_, case_23_ = fennel["search-module"](module_name, fennel["macro-path"]) - if (nil ~= case_22_) then - local fnl_path = case_22_ - case_20_, case_21_ = macro_module__3e_3fchunk(module_name, fnl_path) - elseif (true and (nil ~= case_23_)) then - local _0 = case_22_ - local msg = case_23_ - case_20_, case_21_ = nil, msg + local _22_, _23_ = fennel["search-module"](module_name, fennel["macro-path"]) + if (nil ~= _22_) then + local fnl_path = _22_ + _20_, _21_ = macro_module__3e_3fchunk(module_name, fnl_path) + elseif (true and (nil ~= _23_)) then + local _0 = _22_ + local msg = _23_ + _20_, _21_ = nil, msg else - case_20_, case_21_ = nil + _20_, _21_ = nil end end - if (nil ~= case_20_) then - local chunk = case_20_ + if (nil ~= _20_) then + local chunk = _20_ return chunk - elseif (true and (nil ~= case_21_)) then - local _0 = case_20_ - local error_msg = case_21_ + elseif (true and (nil ~= _21_)) then + local _0 = _20_ + local error_msg = _21_ local backup_handler = MacroRollbackManager["backup-handler-of"](MacroRollbackManager, module_name) local backup_path = backup_handler["determine-active-backup-path"](backup_handler) local Config = require("thyme.config") - local case_25_ = Config["?error-msg"] - if (nil ~= case_25_) then - local msg = case_25_ + local _25_ = Config["?error-msg"] + if (nil ~= _25_) then + local msg = _25_ return nil, MacroLoaderMessenger["mk-failure-reason"](MacroLoaderMessenger, msg) else - local _1 = case_25_ + local _1 = _25_ local max_rollbacks = Config["max-rollbacks"] local rollback_enabled_3f = (0 < max_rollbacks) - local case_26_ + local _26_ if (rollback_enabled_3f and file_readable_3f(backup_path)) then - local case_27_ = macro_module__3e_3fchunk(module_name, backup_path) - if (nil ~= case_27_) then - local chunk = case_27_ + local _27_ = macro_module__3e_3fchunk(module_name, backup_path) + if (nil ~= _27_) then + local chunk = _27_ local msg = ("temporarily restore backup for the macro/%s (created at %s) due to the following error:\n%s\n\nHINT: You can reduce the annoying errors by `:ThymeRollbackMount` in new nvim sessions.\nTo stop the forced rollback after repair, please run `:ThymeRollbackUnmount` or `:ThymeRollbackUnmountAll`."):format(module_name, backup_handler["determine-active-backup-birthtime"](backup_handler), error_msg) RollbackLoaderMessenger["notify-once!"](RollbackLoaderMessenger, msg, vim.log.levels.WARN) - case_26_ = chunk + _26_ = chunk else - case_26_ = nil + _26_ = nil end else - case_26_ = nil + _26_ = nil end - if (nil ~= case_26_) then - local chunk = case_26_ + if (nil ~= _26_) then + local chunk = _26_ return chunk else - local _2 = case_26_ + local _2 = _26_ return nil, MacroLoaderMessenger["mk-failure-reason"](MacroLoaderMessenger, error_msg) end end @@ -159,13 +159,13 @@ end local function initialize_macro_searcher_on_rtp_21(fennel) table.insert(fennel["macro-searchers"], 1, search_fnl_macro_on_rtp_21) local function _34_(...) - local case_35_, case_36_ = search_fnl_macro_on_rtp_21(...) - if (nil ~= case_35_) then - local chunk = case_35_ + local _35_, _36_ = search_fnl_macro_on_rtp_21(...) + if (nil ~= _35_) then + local chunk = _35_ return chunk - elseif (true and (nil ~= case_36_)) then - local _ = case_35_ - local msg = case_36_ + elseif (true and (nil ~= _36_)) then + local _ = _35_ + local msg = _36_ return msg else return nil @@ -175,19 +175,13 @@ local function initialize_macro_searcher_on_rtp_21(fennel) return overwrite_metatable_21(fennel["macro-loaded"], cache["macro-loaded"]) end local function hide_macro_cache_21(module_name) - if (nil == module_name) then - _G.error("Missing argument module-name on fnl/thyme/loader/macro-module.fnl:154", 2) - else - end + _G.assert((nil ~= module_name), "Missing argument module-name on fnl/thyme/loader/macro-module.fnl:154") cache["__macro-loaded"][module_name] = cache["macro-loaded"][module_name] cache["macro-loaded"][module_name] = nil return nil end local function restore_macro_cache_21(module_name) - if (nil == module_name) then - _G.error("Missing argument module-name on fnl/thyme/loader/macro-module.fnl:161", 2) - else - end + _G.assert((nil ~= module_name), "Missing argument module-name on fnl/thyme/loader/macro-module.fnl:161") cache["macro-loaded"][module_name] = cache["__macro-loaded"][module_name] cache["__macro-loaded"][module_name] = nil return nil diff --git a/lua/thyme/loader/runtime-module.lua b/lua/thyme/loader/runtime-module.lua index 375ab82f..42fc418a 100644 --- a/lua/thyme/loader/runtime-module.lua +++ b/lua/thyme/loader/runtime-module.lua @@ -4,7 +4,7 @@ local _local_2_ = require("thyme.util.fs") local file_readable_3f = _local_2_["file-readable?"] local write_lua_file_21 = _local_2_["write-lua-file!"] local _local_3_ = require("thyme.util.iterator") -local gsplit = _local_3_.gsplit +local gsplit = _local_3_["gsplit"] local _local_4_ = require("thyme.util.pool") local can_restore_file_3f = _local_4_["can-restore-file?"] local restore_file_21 = _local_4_["restore-file!"] @@ -29,17 +29,17 @@ local function initialize_module_searcher_on_rtp_21(fennel) local fennel_path local _8_ do - local tbl_26_ = {} - local i_27_ = 0 + local tbl_21_ = {} + local i_22_ = 0 for _, suffix in ipairs({"?.fnl", "?/init.fnl"}) do - local val_28_ = (std_config_home .. fnl_dir .. suffix) - if (nil ~= val_28_) then - i_27_ = (i_27_ + 1) - tbl_26_[i_27_] = val_28_ + local val_23_ = (std_config_home .. fnl_dir .. suffix) + if (nil ~= val_23_) then + i_22_ = (i_22_ + 1) + tbl_21_[i_22_] = val_23_ else end end - _8_ = tbl_26_ + _8_ = tbl_21_ end fennel_path = table.concat(_8_, ";") fennel.path = fennel_path @@ -56,38 +56,38 @@ local function update_fennel_paths_21(fennel) local macro_path local _11_ do - local tbl_26_ = {} - local i_27_ = 0 + local tbl_21_ = {} + local i_22_ = 0 for fnl_template in gsplit(Config["macro-path"], ";") do - local val_28_ + local val_23_ if ("/" == fnl_template:sub(1, 1)) then - val_28_ = fnl_template + val_23_ = fnl_template else local offset, rest = fnl_template:match("^%./([^?]*)(.-)$") local base_paths = base_path_cache[offset] local _12_ do - local tbl_26_0 = {} - local i_27_0 = 0 + local tbl_21_0 = {} + local i_22_0 = 0 for _, dir in pairs(base_paths) do - local val_28_0 = (dir .. rest) - if (nil ~= val_28_0) then - i_27_0 = (i_27_0 + 1) - tbl_26_0[i_27_0] = val_28_0 + local val_23_0 = (dir .. rest) + if (nil ~= val_23_0) then + i_22_0 = (i_22_0 + 1) + tbl_21_0[i_22_0] = val_23_0 else end end - _12_ = tbl_26_0 + _12_ = tbl_21_0 end - val_28_ = table.concat(_12_, ";") + val_23_ = table.concat(_12_, ";") end - if (nil ~= val_28_) then - i_27_ = (i_27_ + 1) - tbl_26_[i_27_] = val_28_ + if (nil ~= val_23_) then + i_22_ = (i_22_ + 1) + tbl_21_[i_22_] = val_23_ else end end - _11_ = tbl_26_ + _11_ = tbl_21_ end macro_path = table.concat(_11_, ";"):gsub("/%./", "/") fennel["macro-path"] = macro_path @@ -136,20 +136,20 @@ local function search_fnl_module_on_rtp_21(module_name, ...) file_loader = _19_ local _21_ do - local case_20_ + local _20_ do - local case_22_ = RuntimeModuleRollbackManager["inject-mounted-backup-searcher!"](RuntimeModuleRollbackManager, package.loaders, file_loader) - if (nil ~= case_22_) then - local searcher = case_22_ - case_20_ = searcher(module_name) + local _22_ = RuntimeModuleRollbackManager["inject-mounted-backup-searcher!"](RuntimeModuleRollbackManager, package.loaders, file_loader) + if (nil ~= _22_) then + local searcher = _22_ + _20_ = searcher(module_name) else - case_20_ = nil + _20_ = nil end end - if (nil ~= case_20_) then - local msg_7cchunk = case_20_ - local case_25_ = type(msg_7cchunk) - if (case_25_ == "function") then + if (nil ~= _20_) then + local msg_7cchunk = _20_ + local _25_ = type(msg_7cchunk) + if (_25_ == "function") then _21_ = msg_7cchunk else _21_ = nil @@ -160,49 +160,49 @@ local function search_fnl_module_on_rtp_21(module_name, ...) end local or_30_ = _21_ if not or_30_ then - local case_31_, case_32_ + local _31_, _32_ = nil, nil do - local case_34_, case_35_ = module_name__3efnl_file_on_rtp_21(module_name) - if (nil ~= case_34_) then - local fnl_path = case_34_ + local _34_, _35_ = module_name__3efnl_file_on_rtp_21(module_name) + if (nil ~= _34_) then + local fnl_path = _34_ local fennel = require("fennel") local _let_36_ = require("thyme.compiler.cache") local determine_lua_path = _let_36_["determine-lua-path"] local lua_path = determine_lua_path(module_name) local compiler_options = Config["compiler-options"] - local case_37_, case_38_ = Observer["observe!"](Observer, fennel["compile-string"], fnl_path, lua_path, compiler_options, module_name) - if ((case_37_ == true) and (nil ~= case_38_)) then - local lua_code = case_38_ + local _37_, _38_ = Observer["observe!"](Observer, fennel["compile-string"], fnl_path, lua_path, compiler_options, module_name) + if ((_37_ == true) and (nil ~= _38_)) then + local lua_code = _38_ if can_restore_file_3f(lua_path, lua_code) then restore_file_21(lua_path) else write_lua_file_with_backup_21(lua_path, lua_code, module_name) backup_handler["cleanup-old-backups!"](backup_handler) end - case_31_, case_32_ = load(lua_code, lua_path) - elseif (true and (nil ~= case_38_)) then - local _ = case_37_ - local raw_msg = case_38_ + _31_, _32_ = load(lua_code, lua_path) + elseif (true and (nil ~= _38_)) then + local _ = _37_ + local raw_msg = _38_ local raw_msg_body = ("%s is found for the runtime/%s, but failed to compile it"):format(fnl_path, module_name) - local msg = LoaderMessenger["mk-failure-reason"](LoaderMessenger, ("%s\n\t%s"):format(raw_msg_body, raw_msg)) - case_31_, case_32_ = nil, msg + local msg = LoaderMessenger["mk-failure-reason"](LoaderMessenger, ("%s\n %s"):format(raw_msg_body, raw_msg)) + _31_, _32_ = nil, msg else - case_31_, case_32_ = nil + _31_, _32_ = nil end - elseif (true and (nil ~= case_35_)) then - local _ = case_34_ - local raw_msg = case_35_ - case_31_, case_32_ = nil, raw_msg + elseif (true and (nil ~= _35_)) then + local _ = _34_ + local raw_msg = _35_ + _31_, _32_ = nil, raw_msg else - case_31_, case_32_ = nil + _31_, _32_ = nil end end - if (nil ~= case_31_) then - local chunk = case_31_ + if (nil ~= _31_) then + local chunk = _31_ or_30_ = chunk - elseif (true and (nil ~= case_32_)) then - local _ = case_31_ - local error_msg = case_32_ + elseif (true and (nil ~= _32_)) then + local _ = _31_ + local error_msg = _32_ local backup_path = backup_handler["determine-active-backup-path"](backup_handler, module_name) local max_rollbacks = Config["max-rollbacks"] local rollback_enabled_3f = (0 < max_rollbacks) diff --git a/lua/thyme/rollback/backup-handler.lua b/lua/thyme/rollback/backup-handler.lua index 498af1ab..f239a369 100644 --- a/lua/thyme/rollback/backup-handler.lua +++ b/lua/thyme/rollback/backup-handler.lua @@ -59,22 +59,22 @@ BackupHandler["determine-active-backup-path"] = function(self) return Path.join(backup_dir, filename) end BackupHandler["determine-active-backup-birthtime"] = function(self) - local case_5_ + local _5_ do local tmp_3_ = self["determine-active-backup-path"](self, self["_module-name"]) if (nil ~= tmp_3_) then local tmp_3_0 = fs.stat(tmp_3_) if (nil ~= tmp_3_0) then - case_5_ = tmp_3_0.birthtime.sec + _5_ = tmp_3_0.birthtime.sec else - case_5_ = nil + _5_ = nil end else - case_5_ = nil + _5_ = nil end end - if (nil ~= case_5_) then - local time = case_5_ + if (nil ~= _5_) then + local time = _5_ return os.date("%c", time) else return nil diff --git a/lua/thyme/rollback/manager.lua b/lua/thyme/rollback/manager.lua index 0b1b82e9..a44fb61d 100644 --- a/lua/thyme/rollback/manager.lua +++ b/lua/thyme/rollback/manager.lua @@ -60,27 +60,21 @@ RollbackManager["list-backup-dirs"] = function(self) end RollbackManager["list-backup-modules"] = function(self) local paths = self["list-backup-dirs"](self) - local tbl_26_ = {} - local i_27_ = 0 + local tbl_21_ = {} + local i_22_ = 0 for _, path in ipairs(paths) do - local val_28_ = vim.fs.basename(path) - if (nil ~= val_28_) then - i_27_ = (i_27_ + 1) - tbl_26_[i_27_] = val_28_ + local val_23_ = vim.fs.basename(path) + if (nil ~= val_23_) then + i_22_ = (i_22_ + 1) + tbl_21_[i_22_] = val_23_ else end end - return tbl_26_ + return tbl_21_ end RollbackManager.new = function(kind, file_extension) - if (nil == file_extension) then - _G.error("Missing argument file-extension on fnl/thyme/rollback/manager.fnl:96", 2) - else - end - if (nil == kind) then - _G.error("Missing argument kind on fnl/thyme/rollback/manager.fnl:96", 2) - else - end + _G.assert((nil ~= file_extension), "Missing argument file-extension on fnl/thyme/rollback/manager.fnl:96") + _G.assert((nil ~= kind), "Missing argument kind on fnl/thyme/rollback/manager.fnl:96") local self = setmetatable({}, RollbackManager) local root = Path.join(RollbackManager._root, kind) vim.fn.mkdir(root, "p") @@ -99,9 +93,9 @@ RollbackManager["list-mounted-paths"] = function() end RollbackManager["unmount-backup-all!"] = function() do - local case_11_ = RollbackManager["list-mounted-paths"]() - if (nil ~= case_11_) then - local mounted_backup_paths = case_11_ + local _9_ = RollbackManager["list-mounted-paths"]() + if (nil ~= _9_) then + local mounted_backup_paths = _9_ for _, path in ipairs(mounted_backup_paths) do assert_is_symlink(path) assert(fs.unlink(path)) diff --git a/lua/thyme/treesitter/chunks.lua b/lua/thyme/treesitter/chunks.lua index 671f2ec8..c1ea5183 100644 --- a/lua/thyme/treesitter/chunks.lua +++ b/lua/thyme/treesitter/chunks.lua @@ -96,16 +96,16 @@ local function compose_hl_chunks(text, lang_tree) hl_query = or_11_ local iter = hl_query:iter_captures(ts_tree:root(), text, top_row0, bottom_row0) for id, node, metadata in iter do - local case_13_ = hl_query.captures[id] - if ((case_13_ == "spell") or (case_13_ == "nospell")) then + local _13_ = hl_query.captures[id] + if ((_13_ == "spell") or (_13_ == "nospell")) then else - local and_14_ = (nil ~= case_13_) + local and_14_ = (nil ~= _13_) if and_14_ then - local capture = case_13_ + local capture = _13_ and_14_ = not vim.startswith(capture, "_") end if and_14_ then - local capture = case_13_ + local capture = _13_ local txt = ts.get_node_text(node, text) local hl_name = ("@" .. capture) local row01, col01 = node:range() @@ -149,10 +149,7 @@ local function compose_hl_chunks(text, lang_tree) return hl_chunks end local function text__3ehl_chunks(text, _3fopts) - if (nil == text) then - _G.error("Missing argument text on fnl/thyme/treesitter/chunks.fnl:128", 2) - else - end + _G.assert((nil ~= text), "Missing argument text on fnl/thyme/treesitter/chunks.fnl:128") validate_type("string", text) if Config["disable-treesitter-highlights"] then return {{text}} @@ -160,26 +157,26 @@ local function text__3ehl_chunks(text, _3fopts) local opts = (_3fopts or {}) local base_lang = (opts.lang or "fennel") local tmp_text - local _21_ + local _20_ if (base_lang == "fennel") then - _21_ = text:gsub("#<(%a+):(%s+0x%x+)>", "#(%1 %2)") + _20_ = text:gsub("#<(%a+):(%s+0x%x+)>", "#(%1 %2)") elseif (base_lang == "lua") then - _21_ = text:gsub("<(%a+%s+%d+)>", "\"%1\"") + _20_ = text:gsub("<(%a+%s+%d+)>", "\"%1\"") else local _ = base_lang - _21_ = text + _20_ = text end - tmp_text = _21_:gsub("\\", "\\\\") + tmp_text = _20_:gsub("\\", "\\\\") local fixed_text = text:gsub("\\", "\\\\") validate_type("table", opts) - local case_26_, case_27_ = pcall(ts.get_string_parser, tmp_text, base_lang) - if ((case_26_ == false) and (nil ~= case_27_)) then - local msg = case_27_ + local _25_, _26_ = pcall(ts.get_string_parser, tmp_text, base_lang) + if ((_25_ == false) and (nil ~= _26_)) then + local msg = _26_ local chunks = {{text}} vim.notify_once(msg, vim.log.levels.WARN) return chunks - elseif ((case_26_ == true) and (nil ~= case_27_)) then - local lang_tree = case_27_ + elseif ((_25_ == true) and (nil ~= _26_)) then + local lang_tree = _26_ return compose_hl_chunks(fixed_text, lang_tree) else return nil diff --git a/lua/thyme/treesitter/init.lua b/lua/thyme/treesitter/init.lua index a2ac1fe3..c3abf568 100644 --- a/lua/thyme/treesitter/init.lua +++ b/lua/thyme/treesitter/init.lua @@ -1,18 +1,12 @@ local _local_1_ = require("thyme.treesitter.chunks") local text__3ehl_chunks = _local_1_["text->hl-chunks"] local function echo(text, _3fopts) - if (nil == text) then - _G.error("Missing argument text on fnl/thyme/treesitter/init.fnl:3", 2) - else - end + _G.assert((nil ~= text), "Missing argument text on fnl/thyme/treesitter/init.fnl:3") local hl_chunks = text__3ehl_chunks(text, _3fopts) return vim.api.nvim_echo(hl_chunks, false, {}) end local function print(text, _3fopts) - if (nil == text) then - _G.error("Missing argument text on fnl/thyme/treesitter/init.fnl:9", 2) - else - end + _G.assert((nil ~= text), "Missing argument text on fnl/thyme/treesitter/init.fnl:9") local hl_chunks = text__3ehl_chunks(text, _3fopts) return vim.api.nvim_echo(hl_chunks, true, {}) end diff --git a/lua/thyme/user/command/fennel/fennel-wrapper.lua b/lua/thyme/user/command/fennel/fennel-wrapper.lua index 86269ade..94daf99f 100644 --- a/lua/thyme/user/command/fennel/fennel-wrapper.lua +++ b/lua/thyme/user/command/fennel/fennel-wrapper.lua @@ -6,10 +6,10 @@ local function make__3fnew_cmd(new_fnl_code, _2_) local trailing_parens = _2_["trailing-parens"] local trimmed_new_fnl_code = new_fnl_code:gsub("%s*[%]}%)]*$", "") local last_cmd = vim.fn.histget(":", -1) - local case_3_, case_4_ = last_cmd:find(trimmed_new_fnl_code, 1, true) - if ((nil ~= case_3_) and (nil ~= case_4_)) then - local idx_start = case_3_ - local idx_end = case_4_ + local _3_, _4_ = last_cmd:find(trimmed_new_fnl_code, 1, true) + if ((nil ~= _3_) and (nil ~= _4_)) then + local idx_start = _3_ + local idx_end = _4_ local prefix = last_cmd:sub(1, (idx_start - 1)) local suffix = new_fnl_code:gsub("%s*$", ""):sub((idx_end - idx_start - -2)) local trimmed_suffix @@ -28,7 +28,7 @@ local function make__3fnew_cmd(new_fnl_code, _2_) end end local function edit_cmd_history_21(new_fnl_code, _7_) - local method = _7_.method + local method = _7_["method"] local opts = _7_ local methods local function _8_(new_cmd) @@ -39,28 +39,28 @@ local function edit_cmd_history_21(new_fnl_code, _7_) return assert((1 == vim.fn.histadd(":", new_cmd)), "failed to add new fnl code") end methods = {overwrite = _8_, append = _9_, ignore = false} - local case_10_ = methods[method] - if (case_10_ == false) then + local _10_ = methods[method] + if (_10_ == false) then --[[ "Do nothing" ]] return nil - elseif (nil ~= case_10_) then - local apply_method = case_10_ - local case_11_ = make__3fnew_cmd(new_fnl_code, opts) - if (nil ~= case_11_) then - local new_cmd = case_11_ + elseif (nil ~= _10_) then + local apply_method = _10_ + local _11_ = make__3fnew_cmd(new_fnl_code, opts) + if (nil ~= _11_) then + local new_cmd = _11_ return apply_method(new_cmd) else return nil end else - local _ = case_10_ + local _ = _10_ return error(("expected one of `overwrite`, `append`, or `ignore`; got unknown method " .. method)) end end local function parse_cmd_buf_args(_14_) - local path = _14_.args - local line1 = _14_.line1 - local line2 = _14_.line2 + local path = _14_["args"] + local line1 = _14_["line1"] + local line2 = _14_["line2"] local bufnr if path:find("^%s*$") then bufnr = 0 @@ -71,17 +71,17 @@ local function parse_cmd_buf_args(_14_) return fnl_code end local function parse_cmd_file_args(_16_) - local _arg_17_ = _16_.fargs + local _arg_17_ = _16_["fargs"] local _3fpath = _arg_17_[1] - local line1 = _16_.line1 - local line2 = _16_.line2 + local line1 = _16_["line1"] + local line2 = _16_["line2"] local full_path = vim.fn.fnamemodify(vim.fn.expand((_3fpath or "%:p")), ":p") return table.concat(vim.list_slice(vim.fn.readfile(full_path, "", line2), line1), "\n") end local function extract_Fnl_cmdline_args(cmdline) - local case_18_, case_19_ = pcall(vim.api.nvim_parse_cmd, cmdline, {}) - if ((case_18_ == true) and (nil ~= case_19_)) then - local parsed = case_19_ + local _18_, _19_ = pcall(vim.api.nvim_parse_cmd, cmdline, {}) + if ((_18_ == true) and (nil ~= _19_)) then + local parsed = _19_ if string.match(parsed.cmd, "^Fnl") then return table.concat(parsed.args, " ") else @@ -92,12 +92,12 @@ local function extract_Fnl_cmdline_args(cmdline) end end local function mk_fennel_wrapper_command_callback(callback, _22_) - local lang = _22_.lang + local lang = _22_["lang"] local compiler_options = _22_["compiler-options"] local cmd_history_opts = _22_["cmd-history-opts"] local function _24_(_23_) - local args = _23_.args - local smods = _23_.smods + local args = _23_["args"] + local smods = _23_["smods"] local verbose_3f = (-1 < smods.verbose) local new_fnl_code = apply_parinfer(args:gsub("\r", "\n"), {["cmd-history-opts"] = cmd_history_opts}) if verbose_3f then @@ -106,12 +106,12 @@ local function mk_fennel_wrapper_command_callback(callback, _22_) else end do - local case_26_ = {callback(new_fnl_code, compiler_options)} - if (case_26_[1] == nil) then + local _26_ = {callback(new_fnl_code, compiler_options)} + if (_26_[1] == nil) then tts.print("nil", {lang = lang}) - elseif (nil ~= case_26_[1]) then - local text = case_26_[1] - local results = case_26_ + elseif (nil ~= _26_[1]) then + local text = _26_[1] + local results = _26_ if (lang == "lua") then tts.print(text, {lang = "lua"}) elseif (lang == "fennel") then @@ -125,9 +125,9 @@ local function mk_fennel_wrapper_command_callback(callback, _22_) end local function _29_() local old_cmdline = vim.fn.histget(":") - local case_30_, case_31_ = pcall(vim.api.nvim_parse_cmd, old_cmdline, {}) - if ((case_30_ == true) and (nil ~= case_31_)) then - local parsed = case_31_ + local _30_, _31_ = pcall(vim.api.nvim_parse_cmd, old_cmdline, {}) + if ((_30_ == true) and (nil ~= _31_)) then + local parsed = _31_ if parsed.cmd:find("^Fnl") then local old_fnl_expr = extract_Fnl_cmdline_args(old_cmdline) local new_fnl_expr = apply_parinfer(old_fnl_expr:gsub("\r", "\n"), {["cmd-history-opts"] = cmd_history_opts}) diff --git a/lua/thyme/user/command/fennel/fnl-file-compile.lua b/lua/thyme/user/command/fennel/fnl-file-compile.lua index a713efe3..c615064b 100644 --- a/lua/thyme/user/command/fennel/fnl-file-compile.lua +++ b/lua/thyme/user/command/fennel/fnl-file-compile.lua @@ -19,66 +19,66 @@ local function compile_to_write_21(fnl_path, force_compile_3f) else local _4_ do - local tbl_26_ = {} - local i_27_ = 0 + local tbl_21_ = {} + local i_22_ = 0 for _, path in ipairs(fnl_path) do - local val_28_ = vim.split(vim.fn.glob(path), "\n") - if (nil ~= val_28_) then - i_27_ = (i_27_ + 1) - tbl_26_[i_27_] = val_28_ + local val_23_ = vim.split(vim.fn.glob(path), "\n") + if (nil ~= val_23_) then + i_22_ = (i_22_ + 1) + tbl_21_[i_22_] = val_23_ else end end - _4_ = tbl_26_ + _4_ = tbl_21_ end fnl_paths = vim.fn.flatten(_4_, 1) end local path_pairs do - local tbl_21_ = {} + local tbl_16_ = {} for _, path in ipairs(fnl_paths) do - local k_22_, v_23_ + local k_17_, v_18_ = nil, nil do local full_path = vim.fn.fnamemodify(path, ":p") - k_22_, v_23_ = full_path, DependencyLogger["fnl-path->lua-path"](DependencyLogger, full_path) + k_17_, v_18_ = full_path, DependencyLogger["fnl-path->lua-path"](DependencyLogger, full_path) end - if ((k_22_ ~= nil) and (v_23_ ~= nil)) then - tbl_21_[k_22_] = v_23_ + if ((k_17_ ~= nil) and (v_18_ ~= nil)) then + tbl_16_[k_17_] = v_18_ else end end - path_pairs = tbl_21_ + path_pairs = tbl_16_ end local existing_lua_files = {} local or_8_ = force_compile_3f if not or_8_ then local _9_ do - local tbl_26_ = {} - local i_27_ = 0 + local tbl_21_ = {} + local i_22_ = 0 for _, lua_file in pairs(path_pairs) do - local val_28_ + local val_23_ if file_readable_3f(lua_file) then - val_28_ = table.insert(existing_lua_files, lua_file) + val_23_ = table.insert(existing_lua_files, lua_file) else - val_28_ = nil + val_23_ = nil end - if (nil ~= val_28_) then - i_27_ = (i_27_ + 1) - tbl_26_[i_27_] = val_28_ + if (nil ~= val_23_) then + i_22_ = (i_22_ + 1) + tbl_21_[i_22_] = val_23_ else end end - _9_ = tbl_26_ + _9_ = tbl_21_ end local and_12_ = _9_ if and_12_ then if (0 < #existing_lua_files) then - local case_13_ = vim.fn.confirm(("The following files have already existed:\n" .. table.concat(existing_lua_files, "\n") .. "\nOverride the files?"), "&No\n&yes") - if (case_13_ == 2) then + local _13_ = vim.fn.confirm(("The following files have already existed:\n" .. table.concat(existing_lua_files, "\n") .. "\nOverride the files?"), "&No\n&yes") + if (_13_ == 2) then and_12_ = true else - local _ = case_13_ + local _ = _13_ CommandMessenger["notify!"](CommandMessenger, "Abort") and_12_ = false end @@ -111,10 +111,10 @@ local function create_commands_21() local cmd_history_opts = {method = "ignore"} local cb local function _23_(_21_) - local fargs = _21_.fargs - local should_write_file_3f = _21_.bang - local _arg_22_ = _21_.mods - local confirm_3f = _arg_22_.confirm + local fargs = _21_["fargs"] + local should_write_file_3f = _21_["bang"] + local _arg_22_ = _21_["mods"] + local confirm_3f = _arg_22_["confirm"] local a = _21_ local fnl_code = parse_cmd_file_args(a) local function _24_() diff --git a/lua/thyme/user/command/fennel/init.lua b/lua/thyme/user/command/fennel/init.lua index a465f126..8c43b03d 100644 --- a/lua/thyme/user/command/fennel/init.lua +++ b/lua/thyme/user/command/fennel/init.lua @@ -16,20 +16,20 @@ local mk_fennel_wrapper_command_callback = _local_3_["mk-fennel-wrapper-command- local fnl_file_compile = require("thyme.user.command.fennel.fnl-file-compile") local M = {} local function open_buf_21(buf_7cpath, _4_) - local split = _4_.split - local tab = _4_.tab + local split = _4_["split"] + local tab = _4_["tab"] local mods = _4_ local split_3f = ((-1 ~= tab) or ("" ~= split)) local cmd do - local case_5_ = type(buf_7cpath) - if (case_5_ == "number") then + local _5_ = type(buf_7cpath) + if (_5_ == "number") then if split_3f then cmd = "sbuffer" else cmd = "buffer" end - elseif (case_5_ == "string") then + elseif (_5_ == "string") then if split_3f then cmd = "split" else @@ -119,23 +119,23 @@ M["setup!"] = function() vim.api.nvim_create_user_command("FnlCompileBuf", cb, cmd_opts) end local function _23_(_21_) - local _arg_22_ = _21_.fargs + local _arg_22_ = _21_["fargs"] local _3fpath = _arg_22_[1] - local mods = _21_.smods + local mods = _21_["smods"] local input_path = vim.fn.expand((_3fpath or "%:p")) local output_path do - local case_24_ = input_path:sub(-4) - if (case_24_ == ".fnl") then - local case_25_ = DependencyLogger["fnl-path->lua-path"](DependencyLogger, input_path) - if (nil ~= case_25_) then - local lua_path = case_25_ + local _24_ = input_path:sub(-4) + if (_24_ == ".fnl") then + local _25_ = DependencyLogger["fnl-path->lua-path"](DependencyLogger, input_path) + if (nil ~= _25_) then + local lua_path = _25_ output_path = lua_path else - local _ = case_25_ - local case_26_ = (input_path:sub(1, -4) .. "lua") - if (nil ~= case_26_) then - local lua_path = case_26_ + local _ = _25_ + local _26_ = (input_path:sub(1, -4) .. "lua") + if (nil ~= _26_) then + local lua_path = _26_ if file_readable_3f(lua_path) then output_path = lua_path else @@ -145,14 +145,14 @@ M["setup!"] = function() output_path = nil end end - elseif (case_24_ == ".lua") then + elseif (_24_ == ".lua") then if vim.startswith(input_path, lua_cache_prefix) then output_path = vim.api.nvim_get_runtime_file(input_path:sub(#lua_cache_prefix):gsub("%.lua$", ".fnl"):gsub("^", "*"), false)[1] else output_path = vim.fn.glob(input_path:gsub("/lua/", "/*/"):gsub("%.lua$", ".fnl"), false) end else - local _ = case_24_ + local _ = _24_ output_path = error("expected a fnl or lua file, got", input_path) end end diff --git a/lua/thyme/user/command/init.lua b/lua/thyme/user/command/init.lua index 11833a55..4c01b1ce 100644 --- a/lua/thyme/user/command/init.lua +++ b/lua/thyme/user/command/init.lua @@ -31,12 +31,12 @@ local function define_commands_21(_3fopts) end vim.api.nvim_create_user_command("ThymeConfigRecommend", _4_, {desc = "[thyme] open a readonly buffer to demonstrate the recommended config file"}) local function _5_() - local case_6_ = vim.fn.confirm("Delete all the thyme's cache, state, and data files? It will NOT modify your config files.", "&No\n&yes", 1, "Warning") - if (case_6_ == 2) then + local _6_ = vim.fn.confirm("Delete all the thyme's cache, state, and data files? It will NOT modify your config files.", "&No\n&yes", 1, "Warning") + if (_6_ == 2) then local files = {lua_cache_prefix, Path.join(vim.fn.stdpath("cache"), "thyme"), Path.join(vim.fn.stdpath("state"), "thyme"), Path.join(vim.fn.stdpath("data"), "thyme")} do - local case_7_ = vim.secure.trust({action = "remove", path = config_path}) - if (case_7_ == true) then + local _7_ = vim.secure.trust({action = "remove", path = config_path}) + if (_7_ == true) then UninstallCommandMessenger["notify!"](UninstallCommandMessenger, "successfully untrust .nvim-thyme.fnl") else end @@ -44,11 +44,11 @@ local function define_commands_21(_3fopts) for _, path in ipairs(files) do assert_is_file_of_thyme(path) if directory_3f(path) then - local case_9_ = vim.fn.delete(path, "rf") - if (case_9_ == 0) then + local _9_ = vim.fn.delete(path, "rf") + if (_9_ == 0) then UninstallCommandMessenger["notify!"](UninstallCommandMessenger, ("successfully deleted " .. path)) else - local _0 = case_9_ + local _0 = _9_ error(("failed to delete " .. path)) end else @@ -56,7 +56,7 @@ local function define_commands_21(_3fopts) end return UninstallCommandMessenger["notify!"](UninstallCommandMessenger, "successfully uninstalled") else - local _ = case_6_ + local _ = _6_ return UninstallCommandMessenger["notify!"](UninstallCommandMessenger, "aborted") end end diff --git a/lua/thyme/user/command/rollback.lua b/lua/thyme/user/command/rollback.lua index 86d5e52e..1f34fe92 100644 --- a/lua/thyme/user/command/rollback.lua +++ b/lua/thyme/user/command/rollback.lua @@ -8,17 +8,14 @@ RollbackCommander["cmdargs->kind-modname"] = function(cmdargs) return cmdargs:match("([^/]+)/?([^/]*)") end RollbackCommander.attach = function(kind) - if (nil == kind) then - _G.error("Missing argument kind on fnl/thyme/user/command/rollback.fnl:19", 2) - else - end + _G.assert((nil ~= kind), "Missing argument kind on fnl/thyme/user/command/rollback.fnl:19") local ext_tmp = ".tmp" return RollbackManager.new(kind, ext_tmp) end RollbackCommander["get-root"] = function(kind, modname) - local tgt_2_ = RollbackCommander.attach(kind) - local tgt_3_ = (tgt_2_)["backup-handler-of"](tgt_2_, modname) - return (tgt_3_)["determine-backup-dir"](tgt_3_) + local tgt_1_ = RollbackCommander.attach(kind) + local tgt_2_ = (tgt_1_)["backup-handler-of"](tgt_1_, modname) + return (tgt_2_)["determine-backup-dir"](tgt_2_) end RollbackCommander["list-backups"] = function(kind, modname) local dir = RollbackCommander["get-root"](kind, modname) @@ -27,58 +24,59 @@ RollbackCommander["list-backups"] = function(kind, modname) return candidates end RollbackCommander["switch-active-backup!"] = function(kind, modname, path) - local tgt_4_ = RollbackCommander.attach(kind) - local tgt_5_ = (tgt_4_)["backup-handler-of"](tgt_4_, modname) - return (tgt_5_)["switch-active-backup!"](tgt_5_, path) + local tgt_3_ = RollbackCommander.attach(kind) + local tgt_4_ = (tgt_3_)["backup-handler-of"](tgt_3_, modname) + return (tgt_4_)["switch-active-backup!"](tgt_4_, path) end RollbackCommander["mount-backup!"] = function(kind, modname) - local tgt_6_ = RollbackCommander.attach(kind) - local tgt_7_ = (tgt_6_)["backup-handler-of"](tgt_6_, modname) - return (tgt_7_)["mount-backup!"](tgt_7_) + local tgt_5_ = RollbackCommander.attach(kind) + local tgt_6_ = (tgt_5_)["backup-handler-of"](tgt_5_, modname) + return (tgt_6_)["mount-backup!"](tgt_6_) end RollbackCommander["unmount-backup!"] = function(kind, modname) - local tgt_8_ = RollbackCommander.attach(kind) - local tgt_9_ = (tgt_8_)["backup-handler-of"](tgt_8_, modname) - return (tgt_9_)["unmount-backup!"](tgt_9_) + local tgt_7_ = RollbackCommander.attach(kind) + local tgt_8_ = (tgt_7_)["backup-handler-of"](tgt_7_, modname) + return (tgt_8_)["unmount-backup!"](tgt_8_) end M["setup!"] = function() do local complete_dirs - local function _10_(arg_lead, _cmdline, _cursorpos) + local function _9_(arg_lead, _cmdline, _cursorpos) local root = RollbackManager["get-root"]() local prefix_length = (2 + #root) local glob_pattern = Path.join(root, (arg_lead .. "**/")) local paths = vim.fn.glob(glob_pattern, false, true) - local tbl_26_ = {} - local i_27_ = 0 + local tbl_21_ = {} + local i_22_ = 0 for _, path in ipairs(paths) do - local val_28_ = path:sub(prefix_length, -2) - if (nil ~= val_28_) then - i_27_ = (i_27_ + 1) - tbl_26_[i_27_] = val_28_ + local val_23_ = path:sub(prefix_length, -2) + if (nil ~= val_23_) then + i_22_ = (i_22_ + 1) + tbl_21_[i_22_] = val_23_ else end end - return tbl_26_ + return tbl_21_ end - complete_dirs = _10_ - local function _13_(_12_) - local args = _12_.args - local function _14_(...) - local case_15_, case_16_ = ... - if ((nil ~= case_15_) and (nil ~= case_16_)) then - local kind = case_15_ - local modname = case_16_ - local function _17_(...) - if (nil ~= ...) then - local candidates = ... - local case_18_ = #candidates - if (case_18_ == 0) then + complete_dirs = _9_ + local function _12_(_11_) + local args = _11_["args"] + local function _13_(...) + local _14_, _15_ = ... + if ((nil ~= _14_) and (nil ~= _15_)) then + local kind = _14_ + local modname = _15_ + local function _16_(...) + local _17_ = ... + if (nil ~= _17_) then + local candidates = _17_ + local _18_ = #candidates + if (_18_ == 0) then return error(("Abort. No backup is found for " .. args)) - elseif (case_18_ == 1) then + elseif (_18_ == 1) then return CommandMessenger["notify!"](CommandMessenger, ("Abort. Only one backup is found for " .. args), vim.log.levels.WARN) else - local _ = case_18_ + local _ = _18_ local function _19_(_241, _242) return (_242 < _241) end @@ -101,27 +99,27 @@ M["setup!"] = function() return vim.ui.select(candidates, {prompt = ("Select rollback for %s: "):format(args), format_item = _20_}, _22_) end else - local __43_ = ... + local __44_ = _17_ return ... end end local tgt_26_ = RollbackCommander.attach(kind) local tgt_27_ = (tgt_26_)["backup-handler-of"](tgt_26_, modname) - return _17_((tgt_27_)["list-backup-files"](tgt_27_)) + return _16_((tgt_27_)["list-backup-files"](tgt_27_)) else - local __43_ = case_15_ + local __44_ = _14_ return ... end end - return _14_(RollbackCommander["cmdargs->kind-modname"](args)) + return _13_(RollbackCommander["cmdargs->kind-modname"](args)) end - vim.api.nvim_create_user_command("ThymeRollbackSwitch", _13_, {nargs = 1, complete = complete_dirs, desc = "[thyme] Prompt to select rollback for compile error"}) + vim.api.nvim_create_user_command("ThymeRollbackSwitch", _12_, {nargs = 1, complete = complete_dirs, desc = "[thyme] Prompt to select rollback for compile error"}) local function _30_(_29_) - local args = _29_.args - local case_31_, case_32_ = RollbackCommander["cmdargs->kind-modname"](args) - if ((nil ~= case_31_) and (nil ~= case_32_)) then - local kind = case_31_ - local modname = case_32_ + local args = _29_["args"] + local _31_, _32_ = RollbackCommander["cmdargs->kind-modname"](args) + if ((nil ~= _31_) and (nil ~= _32_)) then + local kind = _31_ + local modname = _32_ return RollbackCommander["mount-backup!"](kind, modname) else return nil @@ -136,25 +134,25 @@ M["setup!"] = function() local mounted_filename = ".mounted" local glob_patternn = Path.join(root, (arg_lead .. "**/" .. mounted_filename)) local paths = vim.fn.glob(glob_patternn, false, true) - local tbl_26_ = {} - local i_27_ = 0 + local tbl_21_ = {} + local i_22_ = 0 for _, path in ipairs(paths) do - local val_28_ = path:sub(prefix_length, (-2 - #mounted_filename)) - if (nil ~= val_28_) then - i_27_ = (i_27_ + 1) - tbl_26_[i_27_] = val_28_ + local val_23_ = path:sub(prefix_length, (-2 - #mounted_filename)) + if (nil ~= val_23_) then + i_22_ = (i_22_ + 1) + tbl_21_[i_22_] = val_23_ else end end - return tbl_26_ + return tbl_21_ end complete_mounted = _34_ local function _37_(_36_) - local args = _36_.args - local case_38_, case_39_ = RollbackCommander["cmdargs->kind-modname"](args) - if ((nil ~= case_38_) and (nil ~= case_39_)) then - local kind = case_38_ - local modname = case_39_ + local args = _36_["args"] + local _38_, _39_ = RollbackCommander["cmdargs->kind-modname"](args) + if ((nil ~= _38_) and (nil ~= _39_)) then + local kind = _38_ + local modname = _39_ return RollbackCommander["unmount-backup!"](kind, modname) else return nil @@ -162,13 +160,13 @@ M["setup!"] = function() end vim.api.nvim_create_user_command("ThymeRollbackUnmount", _37_, {nargs = "?", complete = complete_mounted, desc = "[thyme] Unmount mounted backup"}) local function _41_() - local case_42_, case_43_ = pcall(RollbackManager["unmount-backup-all!"]) - if ((case_42_ == false) and (nil ~= case_43_)) then - local msg = case_43_ + local _42_, _43_ = pcall(RollbackManager["unmount-backup-all!"]) + if ((_42_ == false) and (nil ~= _43_)) then + local msg = _43_ local tgt_44_ = "format" return CommandMessenger["notify!"](CommandMessenger, "Failed to mount backups:\n%s", (tgt_44_)[msg](tgt_44_, vim.log.levels.WARN)) else - local _ = case_42_ + local _ = _42_ return CommandMessenger["notify!"](CommandMessenger, "Successfully unmounted all the backups", vim.log.levels.INFO) end end diff --git a/lua/thyme/user/dropin/init.lua b/lua/thyme/user/dropin/init.lua index da4b1f85..140077a9 100644 --- a/lua/thyme/user/dropin/init.lua +++ b/lua/thyme/user/dropin/init.lua @@ -10,11 +10,11 @@ local function map_keys_in_cmdline_21() local plug_map_insert = "(thyme-dropin-insert-Fnl-if-needed)" local plug_map_complete = "(thyme-dropin-complete-with-Fnl-if-needed)" do - local case_2_ = opts.cmdline["enter-key"] - if (case_2_ == false) then - elseif (case_2_ == "") then - elseif (nil ~= case_2_) then - local key = case_2_ + local _2_ = opts.cmdline["enter-key"] + if (_2_ == false) then + elseif (_2_ == "") then + elseif (nil ~= _2_) then + local key = _2_ local function _3_() return M.cmdline.replace(vim.fn.getcmdline()) end @@ -23,13 +23,13 @@ local function map_keys_in_cmdline_21() else end end - local case_5_ = opts.cmdline["completion-key"] - if (case_5_ == false) then + local _5_ = opts.cmdline["completion-key"] + if (_5_ == false) then return nil - elseif (case_5_ == "") then + elseif (_5_ == "") then return nil - elseif (nil ~= case_5_) then - local key = case_5_ + elseif (nil ~= _5_) then + local key = _5_ local function _6_() return M.cmdline.complete(vim.fn.getcmdline()) end @@ -49,13 +49,13 @@ local function map_keys_in_cmdwin_21(buf) return M.cmdwin.replace(vim.fn.line(".")) end vim.api.nvim_set_keymap("i", plug_map_insert, "", {noremap = true, callback = _9_}) - local case_10_ = Config.dropin.cmdwin["enter-key"] - if (case_10_ == false) then + local _10_ = Config.dropin.cmdwin["enter-key"] + if (_10_ == false) then return nil - elseif (case_10_ == "") then + elseif (_10_ == "") then return nil - elseif (nil ~= case_10_) then - local key = case_10_ + elseif (nil ~= _10_) then + local key = _10_ vim.api.nvim_buf_set_keymap(buf, "n", key, (plug_map_insert .. ""), {noremap = true, nowait = true}) return vim.api.nvim_buf_set_keymap(buf, "i", key, (plug_map_insert .. ""), {noremap = true, nowait = true}) else diff --git a/lua/thyme/user/dropin/registry.lua b/lua/thyme/user/dropin/registry.lua index 95d9c2c4..ac090ee6 100644 --- a/lua/thyme/user/dropin/registry.lua +++ b/lua/thyme/user/dropin/registry.lua @@ -20,38 +20,29 @@ Registry["resume!"] = function(self) end end Registry["register!"] = function(self, pattern, replacement) - if (nil == replacement) then - _G.error("Missing argument replacement on fnl/thyme/user/dropin/registry.fnl:22", 2) - else - end - if (nil == pattern) then - _G.error("Missing argument pattern on fnl/thyme/user/dropin/registry.fnl:22", 2) - else - end - if (nil == self) then - _G.error("Missing argument self on fnl/thyme/user/dropin/registry.fnl:22", 2) - else - end + _G.assert((nil ~= replacement), "Missing argument replacement on fnl/thyme/user/dropin/registry.fnl:22") + _G.assert((nil ~= pattern), "Missing argument pattern on fnl/thyme/user/dropin/registry.fnl:22") + _G.assert((nil ~= self), "Missing argument self on fnl/thyme/user/dropin/registry.fnl:22") local unit = {pattern = pattern, replacement = replacement} return table.insert(self._registry, unit) end Registry.iter = function(self) local i = 0 - local function _5_() - local case_6_ - local _7_ + local function _2_() + local _3_ + local _4_ do i = (i + 1) - _7_ = i + _4_ = i end - case_6_ = self._registry[_7_] - if (nil ~= case_6_) then - local val = case_6_ + _3_ = self._registry[_4_] + if (nil ~= _3_) then + local val = _3_ return i, val else return nil end end - return _5_ + return _2_ end return Registry diff --git a/lua/thyme/user/dropin/replacer/cmdline.lua b/lua/thyme/user/dropin/replacer/cmdline.lua index 81dea137..1fd70bcd 100644 --- a/lua/thyme/user/dropin/replacer/cmdline.lua +++ b/lua/thyme/user/dropin/replacer/cmdline.lua @@ -18,11 +18,11 @@ DropinCmdline["complete-cmdline!"] = function(self) local tmp_wcm = "" local right_keys do - local case_1_ = old_cmdline:find(new_cmdline, 1, true) - if (case_1_ == nil) then + local _1_ = old_cmdline:find(new_cmdline, 1, true) + if (_1_ == nil) then right_keys = "" - elseif (nil ~= case_1_) then - local shift = case_1_ + elseif (nil ~= _1_) then + local shift = _1_ right_keys = string.rep("", (shift - 1)) else right_keys = nil diff --git a/lua/thyme/user/dropin/replacer/common.lua b/lua/thyme/user/dropin/replacer/common.lua index 7274df56..b2ec53ee 100644 --- a/lua/thyme/user/dropin/replacer/common.lua +++ b/lua/thyme/user/dropin/replacer/common.lua @@ -3,18 +3,9 @@ local validate_type = _local_1_["validate-type"] local Dropin = {} Dropin.__index = Dropin Dropin.new = function(cmdtype, Registry, old_line) - if (nil == old_line) then - _G.error("Missing argument old-line on fnl/thyme/user/dropin/replacer/common.fnl:9", 2) - else - end - if (nil == Registry) then - _G.error("Missing argument Registry on fnl/thyme/user/dropin/replacer/common.fnl:9", 2) - else - end - if (nil == cmdtype) then - _G.error("Missing argument cmdtype on fnl/thyme/user/dropin/replacer/common.fnl:9", 2) - else - end + _G.assert((nil ~= old_line), "Missing argument old-line on fnl/thyme/user/dropin/replacer/common.fnl:9") + _G.assert((nil ~= Registry), "Missing argument Registry on fnl/thyme/user/dropin/replacer/common.fnl:9") + _G.assert((nil ~= cmdtype), "Missing argument cmdtype on fnl/thyme/user/dropin/replacer/common.fnl:9") local self = setmetatable({}, Dropin) self._cmdtype = cmdtype self._registry = Registry @@ -24,27 +15,21 @@ Dropin.new = function(cmdtype, Registry, old_line) end Dropin["restore-old-cmdhist!"] = function(self) local old_cmdline = self["_old-line"] - local function _5_() + local function _2_() return assert((1 == vim.fn.histadd(self._cmdtype, old_cmdline)), ("failed to add old command " .. old_cmdline)) end - return vim.schedule(_5_) + return vim.schedule(_2_) end Dropin["_extract-?invalid-cmd"] = function(self, cmdline) - if (nil == cmdline) then - _G.error("Missing argument cmdline on fnl/thyme/user/dropin/replacer/common.fnl:30", 2) - else - end - if (nil == self) then - _G.error("Missing argument self on fnl/thyme/user/dropin/replacer/common.fnl:30", 2) - else - end - local case_8_, case_9_ = pcall(vim.api.nvim_parse_cmd, cmdline, {}) - if ((case_8_ == false) and (nil ~= case_9_)) then - local msg = case_9_ + _G.assert((nil ~= cmdline), "Missing argument cmdline on fnl/thyme/user/dropin/replacer/common.fnl:30") + _G.assert((nil ~= self), "Missing argument self on fnl/thyme/user/dropin/replacer/common.fnl:30") + local _3_, _4_ = pcall(vim.api.nvim_parse_cmd, cmdline, {}) + if ((_3_ == false) and (nil ~= _4_)) then + local msg = _4_ local expected_error_msg_prefix = "E492: Not an editor command: (.*)" return msg:match(expected_error_msg_prefix) - elseif ((case_8_ == true) and ((_G.type(case_9_) == "table") and (nil ~= case_9_.nextcmd))) then - local nextcmd = case_9_.nextcmd + elseif ((_3_ == true) and ((_G.type(_4_) == "table") and (nil ~= _4_.nextcmd))) then + local nextcmd = _4_.nextcmd if not ("" == nextcmd) then return self["_extract-?invalid-cmd"](self, nextcmd) else @@ -55,25 +40,16 @@ Dropin["_extract-?invalid-cmd"] = function(self, cmdline) end end Dropin["_replace-invalid-cmdline"] = function(self, old_cmdline, invalid_cmd) - if (nil == invalid_cmd) then - _G.error("Missing argument invalid-cmd on fnl/thyme/user/dropin/replacer/common.fnl:44", 2) - else - end - if (nil == old_cmdline) then - _G.error("Missing argument old-cmdline on fnl/thyme/user/dropin/replacer/common.fnl:44", 2) - else - end - if (nil == self) then - _G.error("Missing argument self on fnl/thyme/user/dropin/replacer/common.fnl:44", 2) - else - end + _G.assert((nil ~= invalid_cmd), "Missing argument invalid-cmd on fnl/thyme/user/dropin/replacer/common.fnl:44") + _G.assert((nil ~= old_cmdline), "Missing argument old-cmdline on fnl/thyme/user/dropin/replacer/common.fnl:44") + _G.assert((nil ~= self), "Missing argument self on fnl/thyme/user/dropin/replacer/common.fnl:44") local prefix = old_cmdline:sub(1, (-1 - #invalid_cmd)) local fallback_cmd do local new_cmd = invalid_cmd - for _, _15_ in self._registry:iter() do - local pattern = _15_.pattern - local replacement = _15_.replacement + for _, _7_ in self._registry:iter() do + local pattern = _7_["pattern"] + local replacement = _7_["replacement"] if (new_cmd ~= invalid_cmd) then break end new_cmd = invalid_cmd:gsub(pattern, replacement) end @@ -84,16 +60,16 @@ Dropin["_replace-invalid-cmdline"] = function(self, old_cmdline, invalid_cmd) end Dropin["normalize-cmdline"] = function(self) local old_line = self["_old-line"] - local _17_ + local _9_ do - local case_16_ = self["_extract-?invalid-cmd"](self, old_line) - if (nil ~= case_16_) then - local invalid_cmd = case_16_ - _17_ = self["_replace-invalid-cmdline"](self, old_line, invalid_cmd) + local _8_ = self["_extract-?invalid-cmd"](self, old_line) + if (nil ~= _8_) then + local invalid_cmd = _8_ + _9_ = self["_replace-invalid-cmdline"](self, old_line, invalid_cmd) else - _17_ = nil + _9_ = nil end end - return (_17_ or old_line) + return (_9_ or old_line) end return Dropin diff --git a/lua/thyme/user/keymap.lua b/lua/thyme/user/keymap.lua index 4ea98172..363cc849 100644 --- a/lua/thyme/user/keymap.lua +++ b/lua/thyme/user/keymap.lua @@ -8,8 +8,8 @@ local M = {} local Keymap = {} Keymap.__index = Keymap Keymap.new = function(_2_) - local backend = _2_.backend - local lang = _2_.lang + local backend = _2_["backend"] + local lang = _2_["lang"] local self = setmetatable({}, Keymap) self["_module-name"] = "thyme.user.keymap" self["_callback-prefix"] = "new_operator_" @@ -80,9 +80,9 @@ Keymap["map-keys-on-ft=lua!"] = function() for _, rhs_key in ipairs(lhs_rhs_pairs_on_ft_3dlua) do local rhs = plug_keymap_template(rhs_key) for mode, rhs__3elhs in pairs(keymap_recipes) do - local case_8_ = rhs__3elhs[rhs_key] - if (nil ~= case_8_) then - local lhs = case_8_ + local _8_ = rhs__3elhs[rhs_key] + if (nil ~= _8_) then + local lhs = _8_ vim.keymap.set(mode, lhs, rhs, {buffer = true}) else end diff --git a/lua/thyme/util/buf.lua b/lua/thyme/util/buf.lua index 5086df04..96b1dcaa 100644 --- a/lua/thyme/util/buf.lua +++ b/lua/thyme/util/buf.lua @@ -1,16 +1,16 @@ local function buf_get_text_in_range(buf, start, _end) local _3_ do - local case_1_, case_2_ = start, _end - if (((_G.type(case_1_) == "table") and (nil ~= case_1_[1]) and (nil ~= case_1_[2])) and ((_G.type(case_2_) == "table") and (nil ~= case_2_[1]) and (nil ~= case_2_[2]))) then - local row1 = case_1_[1] - local col01 = case_1_[2] - local row2 = case_2_[1] - local col02 = case_2_[2] + local _1_, _2_ = start, _end + if (((_G.type(_1_) == "table") and (nil ~= _1_[1]) and (nil ~= _1_[2])) and ((_G.type(_2_) == "table") and (nil ~= _2_[1]) and (nil ~= _2_[2]))) then + local row1 = _1_[1] + local col01 = _1_[2] + local row2 = _2_[1] + local col02 = _2_[2] _3_ = vim.api.nvim_buf_get_text(buf, (row1 - 1), col01, (row2 - 1), (col02 + 1), {}) - elseif ((nil ~= case_1_) and (nil ~= case_2_)) then - local row1 = case_1_ - local row2 = case_2_ + elseif ((nil ~= _1_) and (nil ~= _2_)) then + local row1 = _1_ + local row2 = _2_ _3_ = vim.api.nvim_buf_get_lines(buf, (row1 - 1), row2, true) else _3_ = nil @@ -19,26 +19,26 @@ local function buf_get_text_in_range(buf, start, _end) return table.concat(_3_, "\n") end local function buf_marks__3etext(...) - local buf, mark1, mark2 + local buf, mark1, mark2 = nil, nil, nil do - local case_7_ = select("#", ...) - if (case_7_ == 2) then + local _7_ = select("#", ...) + if (_7_ == 2) then buf, mark1, mark2 = 0, ... - elseif (case_7_ == 3) then + elseif (_7_ == 3) then buf, mark1, mark2 = ... else - local _ = case_7_ + local _ = _7_ buf, mark1, mark2 = error(("expected 2 or 3 args, got " .. table.concat({...}, ","))) end end - local start, _end + local start, _end = nil, nil do - local case_9_, case_10_ = vim.api.nvim_buf_get_mark(buf, mark1), vim.api.nvim_buf_get_mark(buf, mark2) - if (((_G.type(case_9_) == "table") and (nil ~= case_9_[1])) and ((_G.type(case_10_) == "table") and (nil ~= case_10_[1]))) then - local row1 = case_9_[1] - local start0 = case_9_ - local row2 = case_10_[1] - local _end0 = case_10_ + local _9_, _10_ = vim.api.nvim_buf_get_mark(buf, mark1), vim.api.nvim_buf_get_mark(buf, mark2) + if (((_G.type(_9_) == "table") and (nil ~= _9_[1])) and ((_G.type(_10_) == "table") and (nil ~= _10_[1]))) then + local row1 = _9_[1] + local start0 = _9_ + local row2 = _10_[1] + local _end0 = _10_ if (row1 <= row2) then start, _end = start0, _end0 else diff --git a/lua/thyme/util/class/hashmap.lua b/lua/thyme/util/class/hashmap.lua index f871dfed..78c9784d 100644 --- a/lua/thyme/util/class/hashmap.lua +++ b/lua/thyme/util/class/hashmap.lua @@ -19,14 +19,8 @@ HashMap["or-insert!"] = function(self, key, value) end end HashMap.get = function(self, key) - if (nil == key) then - _G.error("Missing argument key on fnl/thyme/util/class/hashmap.fnl:27", 2) - else - end - if (nil == self) then - _G.error("Missing argument self on fnl/thyme/util/class/hashmap.fnl:27", 2) - else - end + _G.assert((nil ~= key), "Missing argument key on fnl/thyme/util/class/hashmap.fnl:27") + _G.assert((nil ~= self), "Missing argument self on fnl/thyme/util/class/hashmap.fnl:27") return self._hash_map[key] end HashMap["contains?"] = function(self, key) @@ -37,30 +31,30 @@ HashMap["contains?"] = function(self, key) end end HashMap.keys = function(self) - local tbl_26_ = {} - local i_27_ = 0 + local tbl_21_ = {} + local i_22_ = 0 for key in pairs(self._hash_map) do - local val_28_ = key - if (nil ~= val_28_) then - i_27_ = (i_27_ + 1) - tbl_26_[i_27_] = val_28_ + local val_23_ = key + if (nil ~= val_23_) then + i_22_ = (i_22_ + 1) + tbl_21_[i_22_] = val_23_ else end end - return tbl_26_ + return tbl_21_ end HashMap.values = function(self) - local tbl_26_ = {} - local i_27_ = 0 + local tbl_21_ = {} + local i_22_ = 0 for _key, val in pairs(self._hash_map) do - local val_28_ = val - if (nil ~= val_28_) then - i_27_ = (i_27_ + 1) - tbl_26_[i_27_] = val_28_ + local val_23_ = val + if (nil ~= val_23_) then + i_22_ = (i_22_ + 1) + tbl_21_[i_22_] = val_23_ else end end - return tbl_26_ + return tbl_21_ end HashMap["hide!"] = function(self) self["_hidden-map"] = self._hash_map diff --git a/lua/thyme/util/fs.lua b/lua/thyme/util/fs.lua index c62ad372..324c5134 100644 --- a/lua/thyme/util/fs.lua +++ b/lua/thyme/util/fs.lua @@ -73,9 +73,9 @@ local function assert_is_log_file(log_path) end local function read_file(path) local file = assert(io.open(path, "r"), ("failed to read " .. path)) - local function close_handlers_13_(ok_14_, ...) + local function close_handlers_12_(ok_13_, ...) file:close() - if ok_14_ then + if ok_13_ then return ... else return error(..., 0) @@ -108,13 +108,13 @@ local function read_file(path) end or_16_ = {traceback = _17_} end - return close_handlers_13_(_G.xpcall(_10_, or_16_.traceback)) + return close_handlers_12_(_G.xpcall(_10_, or_16_.traceback)) end local function write_file_21(path, contents) local f = assert(io.open(path, "w"), ("failed to write to " .. path)) - local function close_handlers_13_(ok_14_, ...) + local function close_handlers_12_(ok_13_, ...) f:close() - if ok_14_ then + if ok_13_ then return ... else return error(..., 0) @@ -147,13 +147,13 @@ local function write_file_21(path, contents) end or_25_ = {traceback = _26_} end - return close_handlers_13_(_G.xpcall(_19_, or_25_.traceback)) + return close_handlers_12_(_G.xpcall(_19_, or_25_.traceback)) end local function append_file_21(path, contents) local f = assert(io.open(path, "a"), ("failed to append to " .. path)) - local function close_handlers_13_(ok_14_, ...) + local function close_handlers_12_(ok_13_, ...) f:close() - if ok_14_ then + if ok_13_ then return ... else return error(..., 0) @@ -186,7 +186,7 @@ local function append_file_21(path, contents) end or_34_ = {traceback = _35_} end - return close_handlers_13_(_G.xpcall(_28_, or_34_.traceback)) + return close_handlers_12_(_G.xpcall(_28_, or_34_.traceback)) end local function delete_file_21(path) return uv.fs_unlink(path) @@ -251,13 +251,13 @@ uv["symlink!"] = function(path, new_path, ...) hide_file_21(new_path) else end - local case_41_, case_42_ + local _41_, _42_ = nil, nil local function _43_() return vim.uv.fs_symlink(path, new_path) end - case_41_, case_42_ = pcall(assert(_43_)) - if ((case_41_ == false) and (nil ~= case_42_)) then - local msg = case_42_ + _41_, _42_ = pcall(assert(_43_)) + if ((_41_ == false) and (nil ~= _42_)) then + local msg = _42_ if has_hidden_file_3f(new_path) then return true else @@ -266,7 +266,7 @@ uv["symlink!"] = function(path, new_path, ...) return false end else - local _ = case_41_ + local _ = _41_ return true end end diff --git a/lua/thyme/util/general.lua b/lua/thyme/util/general.lua index d3032246..6b6da288 100644 --- a/lua/thyme/util/general.lua +++ b/lua/thyme/util/general.lua @@ -44,11 +44,11 @@ local function new_matrix(row, col, val) end local function sorter_2ffiles_to_oldest_by_birthtime(file1, file2) local _let_4_ = vim.uv.fs_stat(file1).birthtime - local sec1 = _let_4_.sec - local nsec1 = _let_4_.nsec + local sec1 = _let_4_["sec"] + local nsec1 = _let_4_["nsec"] local _let_5_ = vim.uv.fs_stat(file2).birthtime - local sec2 = _let_5_.sec - local nsec2 = _let_5_.nsec + local sec2 = _let_5_["sec"] + local nsec2 = _let_5_["nsec"] return ((sec2 < sec1) or ((sec2 == sec1) and (nsec2 < nsec1))) end return {["do-nothing"] = do_nothing, ["contains?"] = contains_3f, ["starts-with?"] = starts_with_3f, ["ends-with?"] = ends_with_3f, ["validate-type"] = validate_type, ["new-matrix"] = new_matrix, ["sorter/files-to-oldest-by-birthtime"] = sorter_2ffiles_to_oldest_by_birthtime} diff --git a/lua/thyme/util/iterator.lua b/lua/thyme/util/iterator.lua index 97f5bdde..b9c77e4b 100644 --- a/lua/thyme/util/iterator.lua +++ b/lua/thyme/util/iterator.lua @@ -37,9 +37,9 @@ local function uncouple_substrings(str, delimiter) if not ("" == rest) then result = rest do - local case_6_ = reversed_str:find(delimiter, 1, true) - if (nil ~= case_6_) then - local idx = case_6_ + local _6_ = reversed_str:find(delimiter, 1, true) + if (nil ~= _6_) then + local idx = _6_ rest = str:sub(1, (-1 - idx)) else end @@ -75,17 +75,17 @@ end local function pairs_from_longer_key(tbl) local keys do - local tbl_26_ = {} - local i_27_ = 0 + local tbl_21_ = {} + local i_22_ = 0 for k, _ in pairs(tbl) do - local val_28_ = k - if (nil ~= val_28_) then - i_27_ = (i_27_ + 1) - tbl_26_[i_27_] = val_28_ + local val_23_ = k + if (nil ~= val_23_) then + i_22_ = (i_22_ + 1) + tbl_21_[i_22_] = val_23_ else end end - keys = tbl_26_ + keys = tbl_21_ end local function _13_(a, b) return (#b < #a) diff --git a/lua/thyme/util/trust.lua b/lua/thyme/util/trust.lua index 9744f980..489e040e 100644 --- a/lua/thyme/util/trust.lua +++ b/lua/thyme/util/trust.lua @@ -32,11 +32,11 @@ M["allowed?"] = function(raw_path) local trusted_3f = false for _, line in ipairs(trust_contents) do if trusted_3f then break end - local case_5_ = (line:find((" " .. config_path), 1, true) or line:find((" " .. resolved_path))) - if (case_5_ == nil) then + local _5_ = (line:find((" " .. config_path), 1, true) or line:find((" " .. resolved_path))) + if (_5_ == nil) then trusted_3f = false else - local _0 = case_5_ + local _0 = _5_ if line:find(allowed_pattern) then trusted_3f = true else @@ -58,11 +58,11 @@ M["denied?"] = function(raw_path) local trusted_3f = false for _, line in ipairs(trust_contents) do if trusted_3f then break end - local case_9_ = (line:find((" " .. config_path), 1, true) or line:find((" " .. resolved_path))) - if (case_9_ == nil) then + local _9_ = (line:find((" " .. config_path), 1, true) or line:find((" " .. resolved_path))) + if (_9_ == nil) then trusted_3f = false else - local _0 = case_9_ + local _0 = _9_ if line:find(denied_pattern) then trusted_3f = true else diff --git a/lua/thyme/util/uri.lua b/lua/thyme/util/uri.lua index 9fe36a47..0a13be24 100644 --- a/lua/thyme/util/uri.lua +++ b/lua/thyme/util/uri.lua @@ -1,5 +1,5 @@ local _local_1_ = require("bit") -local tohex = _local_1_.tohex +local tohex = _local_1_["tohex"] local Path = require("thyme.util.path") local function encode_with_percent(char) return ("%" .. tohex(string.byte(char), 2)) @@ -8,17 +8,17 @@ local function uri_encode(uri) local appname = (vim.env.NVIM_APPNAME or "nvim") local split_pattern = ("/" .. appname .. ".-/") local percent_patterns = "[^A-Za-z0-9%-_.!~*'()]" - local case_2_, case_3_ = string.find(uri, split_pattern) - if (true and (nil ~= case_3_)) then - local _start = case_2_ - local _end = case_3_ + local _2_, _3_ = string.find(uri, split_pattern) + if (true and (nil ~= _3_)) then + local _start = _2_ + local _end = _3_ local prefix = uri:sub(1, (_end - 1)) local suffix = uri:sub((_end + 1)) local prefix_encoded = prefix:gsub(percent_patterns, encode_with_percent) local suffix_encoded = suffix:gsub(percent_patterns, encode_with_percent) return Path.join(prefix_encoded, suffix_encoded) else - local _ = case_2_ + local _ = _2_ return uri:gsub(percent_patterns, encode_with_percent) end end @@ -26,9 +26,9 @@ local function hex__3echar(hex) return string.char(tonumber(hex, 16)) end local function uri_decode(uri) - local case_5_ = uri:gsub("%%([a-fA-F0-9][a-fA-F0-9])", hex__3echar) - if (nil ~= case_5_) then - local decoded = case_5_ + local _5_ = uri:gsub("%%([a-fA-F0-9][a-fA-F0-9])", hex__3echar) + if (nil ~= _5_) then + local decoded = _5_ return decoded else return nil diff --git a/lua/thyme/wrapper/nvim.lua b/lua/thyme/wrapper/nvim.lua index 404e9c6d..c5779787 100644 --- a/lua/thyme/wrapper/nvim.lua +++ b/lua/thyme/wrapper/nvim.lua @@ -9,9 +9,9 @@ local function get_runtime_files(pats, all_3f) else for _, pat in ipairs(pats) do if files[1] then break end - local case_1_ = vim.api.nvim_get_runtime_file(pat, all_3f) - if ((_G.type(case_1_) == "table") and (nil ~= case_1_[1])) then - local path = case_1_[1] + local _1_ = vim.api.nvim_get_runtime_file(pat, all_3f) + if ((_G.type(_1_) == "table") and (nil ~= _1_[1])) then + local path = _1_[1] files[1] = path else end diff --git a/lua/thyme/wrapper/parinfer.lua b/lua/thyme/wrapper/parinfer.lua index 49bdc8b2..513aaffe 100644 --- a/lua/thyme/wrapper/parinfer.lua +++ b/lua/thyme/wrapper/parinfer.lua @@ -2,21 +2,21 @@ local ffi = require("ffi") local Path = require("thyme.util.path") local _local_1_ = require("thyme.wrapper.nvim") local get_runtime_files = _local_1_["get-runtime-files"] -local json_encode = vim.json.encode -local json_decode = vim.json.decode +local json_encode = vim.json["encode"] +local json_decode = vim.json["decode"] local cache = {["parinfer-loader"] = nil} local vim_var_suffixes do local vim_var_prefix = "parinfer_" - local tbl_21_ = {} + local tbl_16_ = {} for k, v in pairs({mode = "mode", enabled = "enabled", trail_highlight = "trail_highlight", trail_highlight_group = "trail_highlight_group", force_balance = "forceBalance", comment_char = "commentChar", string_delimiters = "stringDelimiters", lisp_vline_symbols = "lispVlineSymbols", lisp_block_comments = "lispBlockComments", guile_block_comments = "guileBlockComments", scheme_sexp_comments = "schemeSexpComments", janet_long_strings = "janetLongStrings"}) do - local k_22_, v_23_ = (vim_var_prefix .. k), v - if ((k_22_ ~= nil) and (v_23_ ~= nil)) then - tbl_21_[k_22_] = v_23_ + local k_17_, v_18_ = (vim_var_prefix .. k), v + if ((k_17_ ~= nil) and (v_18_ ~= nil)) then + tbl_16_[k_17_] = v_18_ else end end - vim_var_suffixes = tbl_21_ + vim_var_suffixes = tbl_16_ end local function vim_var__3elib_opts(_3fval) if ("number" == type(_3fval)) then @@ -26,36 +26,40 @@ local function vim_var__3elib_opts(_3fval) end end local function collect_gvar_options() - local tbl_21_ = {} + if not vim.g.parinfer_loaded then + vim.cmd("runtime plugin/parinfer.vim") + else + end + local tbl_16_ = {} for vim_var_suffix, lib_opt_name in pairs(vim_var_suffixes) do - local k_22_, v_23_ = lib_opt_name, vim_var__3elib_opts(vim.g[vim_var_suffix]) - if ((k_22_ ~= nil) and (v_23_ ~= nil)) then - tbl_21_[k_22_] = v_23_ + local k_17_, v_18_ = lib_opt_name, vim_var__3elib_opts(vim.g[vim_var_suffix]) + if ((k_17_ ~= nil) and (v_18_ ~= nil)) then + tbl_16_[k_17_] = v_18_ else end end - return tbl_21_ + return tbl_16_ end local function search_parinfer_lib() local parinfer_lib do - local case_5_ = ffi.os:lower() - if (case_5_ == "windows") then + local _6_ = ffi.os:lower() + if (_6_ == "windows") then parinfer_lib = "parinfer_rust.dll" - elseif (case_5_ == "osx") then + elseif (_6_ == "osx") then parinfer_lib = "libparinfer_rust.dylib" else - local _ = case_5_ + local _ = _6_ parinfer_lib = "libparinfer_rust.so" end end local rtp_paths_to_parinfer_lib = {Path.join("target", "release", parinfer_lib), parinfer_lib} - local case_7_ = get_runtime_files(rtp_paths_to_parinfer_lib, false) - if ((_G.type(case_7_) == "table") and (nil ~= case_7_[1])) then - local lib = case_7_[1] + local _8_ = get_runtime_files(rtp_paths_to_parinfer_lib, false) + if ((_G.type(_8_) == "table") and (nil ~= _8_[1])) then + local lib = _8_[1] return lib else - local _ = case_7_ + local _ = _8_ return error(("failed to find %s. Please make sure to install %s iu your &runtimepath"):format(parinfer_lib, "https://github.com/eraserhd/parinfer-rust")) end end @@ -63,10 +67,10 @@ local function load_parinfer() local lib = search_parinfer_lib() local parinfer_lib = ffi.load(lib) ffi.cdef("char *run_parinfer(const char *json);") - local function _9_(request) + local function _10_(request) return json_decode(ffi.string(parinfer_lib.run_parinfer(json_encode(request)))) end - return _9_ + return _10_ end local function apply_parinfer(text, _3fopts) if (nil == cache["parinfer-loader"]) then @@ -85,7 +89,7 @@ local function apply_parinfer(text, _3fopts) if result.success then return result.text else - local msg = ("Error in applying parinfer to the text:\n%s\nPassed Options:\n%s\nParinfer Result:\n%s"):format(text, vim.inspect((_3fopts or {})), vim.inspect(result)) + local msg = ("Error in applying parinfer to the text:\n%s\nPassed Options:\n%s\nParinfer Result:\n%s"):format(text, vim.inspect(options), vim.inspect(result)) return error(msg) end end