summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlvimuser <[email protected]>2022-09-07 04:10:47 -0300
committerGitHub <[email protected]>2022-09-07 09:10:47 +0200
commit2519e07423e2f6ce4cbed6483305dcaa5bbabf4e (patch)
tree4f4def9f8775cca9d059e6fecd9792388b1d2eb5
parent461203bf25a41d7ae3d134c5b3a0f61443158fd2 (diff)
fix(core/autocmds): do not check for existence on clear_augroup (#2963)
fix #2952 Co-authored-by: kylo252 <[email protected]> Co-authored-by: kylo252 <[email protected]>
-rw-r--r--lua/lvim/core/autocmds.lua14
1 files changed, 3 insertions, 11 deletions
diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua
index 20716e83..f5c63588 100644
--- a/lua/lvim/core/autocmds.lua
+++ b/lua/lvim/core/autocmds.lua
@@ -155,19 +155,11 @@ end
---@param name string the augroup name
function M.clear_augroup(name)
-- defer the function in case the autocommand is still in-use
- local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = name })
- if not exists then
- Log:debug("ignoring request to clear autocmds from non-existent group " .. name)
- return
- end
+ Log:debug("request to clear autocmds " .. name)
vim.schedule(function()
- local status_ok, _ = xpcall(function()
+ pcall(function()
vim.api.nvim_clear_autocmds { group = name }
- end, debug.traceback)
- if not status_ok then
- Log:warn("problems detected while clearing autocmds from " .. name)
- Log:debug(debug.traceback())
- end
+ end)
end)
end