As you may have noticed, I have added the :defer command.
It works mostly like it does in the Go language: you can define a
function to be called when the current function returns.
The arguments are evaluated at the :defer command, thus you can also use
it inside a loop, e.g. when creating a bunch of temp files:

        for n in range(5)
          var fname = $'tempfile{n}'
          CreateFile(fname)
          defer delete(fname)
          # do some work here
        endfor

On top of that, the writefile() and mkdir() functions have a new flag
that tells them to defer a delete() function call to clean up what was
written.  This is especially useful in tests, where we often create a
script file that needs to be deleted once the test is done.  Many times
the delete() was missing or used the wrong name.

        for n in range(5)
          writefile(text[n], $'tempfile{n}', 'D')
        endfor

Please give it a beating and see if it works as advertised.

I'll update the tests to use these new features soon.

-- 
hundred-and-one symptoms of being an internet addict:
32. You don't know what sex three of your closest friends are, because they
    have neutral nicknames and you never bothered to ask.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220909152125.B048E1C0CF3%40moolenaar.net.

Raspunde prin e-mail lui