0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.4186: cannot use an import in 'patchexpr'

Problem:    Cannot use an import in 'patchexpr'.
Solution:   Set the script context when evaluating 'patchexpr'.  Do not
            require 'patchexpr' to return a bool, it was ignored anyway.
This commit is contained in:
Bram Moolenaar
2022-01-22 20:55:30 +00:00
parent 28e60cc088
commit 36c2add7f8
3 changed files with 45 additions and 2 deletions

View File

@@ -443,15 +443,26 @@ eval_patch(
char_u *difffile,
char_u *outfile)
{
int err;
sctx_T saved_sctx = current_sctx;
sctx_T *ctx;
typval_T *tv;
set_vim_var_string(VV_FNAME_IN, origfile, -1);
set_vim_var_string(VV_FNAME_DIFF, difffile, -1);
set_vim_var_string(VV_FNAME_OUT, outfile, -1);
(void)eval_to_bool(p_pex, &err, NULL, FALSE);
ctx = get_option_sctx("patchexpr");
if (ctx != NULL)
current_sctx = *ctx;
// errors are ignored
tv = eval_expr(p_pex, NULL);
free_tv(tv);
set_vim_var_string(VV_FNAME_IN, NULL, -1);
set_vim_var_string(VV_FNAME_DIFF, NULL, -1);
set_vim_var_string(VV_FNAME_OUT, NULL, -1);
current_sctx = saved_sctx;
}
# endif