aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/helpers.h
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-02-28 20:57:24 +0100
committerGitHub <noreply@github.com>2022-02-28 20:57:24 +0100
commitcf0266fae1b24ced577dfb8673c11efd4ceb1627 (patch)
tree0f0e998db32c33139809bce38b18e6ae54639165 /src/nvim/api/private/helpers.h
parent6732cd9e57bf39d1a0f5c4fa08fa54c1561f2d2f (diff)
parent0f613482b389ad259dd53d893907b024a115352e (diff)
downloadrneovim-cf0266fae1b24ced577dfb8673c11efd4ceb1627.tar.gz
rneovim-cf0266fae1b24ced577dfb8673c11efd4ceb1627.tar.bz2
rneovim-cf0266fae1b24ced577dfb8673c11efd4ceb1627.zip
Merge pull request #17551 from bfredl/lua_autocmd_rebase
feat(lua_autocmd): episode III (the autocmds strike back)
Diffstat (limited to 'src/nvim/api/private/helpers.h')
-rw-r--r--src/nvim/api/private/helpers.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h
index 6969994c3b..bc7c2e6a60 100644
--- a/src/nvim/api/private/helpers.h
+++ b/src/nvim/api/private/helpers.h
@@ -152,13 +152,15 @@ typedef struct {
#endif
#define WITH_SCRIPT_CONTEXT(channel_id, code) \
- const sctx_T save_current_sctx = current_sctx; \
- current_sctx.sc_sid = \
- (channel_id) == LUA_INTERNAL_CALL ? SID_LUA : SID_API_CLIENT; \
- current_sctx.sc_lnum = 0; \
- current_channel_id = channel_id; \
- code; \
- current_sctx = save_current_sctx;
+ do { \
+ const sctx_T save_current_sctx = current_sctx; \
+ current_sctx.sc_sid = \
+ (channel_id) == LUA_INTERNAL_CALL ? SID_LUA : SID_API_CLIENT; \
+ current_sctx.sc_lnum = 0; \
+ current_channel_id = channel_id; \
+ code; \
+ current_sctx = save_current_sctx; \
+ } while (0);
#endif // NVIM_API_PRIVATE_HELPERS_H