aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/vim.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-06-23 20:10:28 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-06-30 13:13:08 +0200
commitd33aaa0f5f96afb1608a4a3eb2057da956a24b2b (patch)
tree914d11e9d5d4d769069a11841371d1cc8cd1a802 /src/nvim/lua/vim.lua
parent7030d7daf1f40e5a3963340d1107d7b7a713df5f (diff)
downloadrneovim-d33aaa0f5f96afb1608a4a3eb2057da956a24b2b.tar.gz
rneovim-d33aaa0f5f96afb1608a4a3eb2057da956a24b2b.tar.bz2
rneovim-d33aaa0f5f96afb1608a4a3eb2057da956a24b2b.zip
libluv: use luv_set_callback to control callback execution
Disable the use of deferred API functions in a fast lua callback Correctly display error messages from a fast lua callback
Diffstat (limited to 'src/nvim/lua/vim.lua')
-rw-r--r--src/nvim/lua/vim.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua
index 848bccaae6..46c96b455f 100644
--- a/src/nvim/lua/vim.lua
+++ b/src/nvim/lua/vim.lua
@@ -172,11 +172,22 @@ local function __index(t, key)
end
end
+--- Defers the wrapped callback until when the nvim API is safe to call.
+---
+--- See |vim-loop-callbacks|
+local function schedule_wrap(cb)
+ return (function (...)
+ local args = {...}
+ vim.schedule(function() cb(unpack(args)) end)
+ end)
+end
+
local module = {
_update_package_paths = _update_package_paths,
_os_proc_children = _os_proc_children,
_os_proc_info = _os_proc_info,
_system = _system,
+ schedule_wrap = schedule_wrap,
}
setmetatable(module, {