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

patch 9.0.0411: only created files can be cleaned up with one call

Problem:    Only created files can be cleaned up with one call.
Solution:   Add flags to mkdir() to delete with a deferred function.
            Expand the writefile() name to a full path to handle changing
            directory.
This commit is contained in:
Bram Moolenaar
2022-09-07 21:30:44 +01:00
parent d7633114af
commit 6f14da15ac
9 changed files with 163 additions and 27 deletions

View File

@@ -5649,6 +5649,21 @@ ex_defer_inner(
return add_defer(name, argcount, argvars);
}
/*
* Return TRUE if currently inside a function call.
* Give an error message and return FALSE when not.
*/
int
can_add_defer(void)
{
if (!in_def_function() && get_current_funccal() == NULL)
{
semsg(_(e_str_not_inside_function), "defer");
return FALSE;
}
return TRUE;
}
/*
* Add a deferred call for "name" with arguments "argvars[argcount]".
* Consumes "argvars[]".