|
@@ -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
|
|
|
|