To: vim_dev@googlegroups.com Subject: Patch 8.0.0655 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0655 Problem: Not easy to make sure a function does not exist. Solution: Add ! as an optional argument to :delfunc. Files: src/userfunc.c, src/ex_cmds.h, src/testdir/test_vimscript.vim *** ../vim-8.0.0654/src/userfunc.c 2017-06-22 19:11:45.011344824 +0200 --- src/userfunc.c 2017-06-22 18:40:56.814037821 +0200 *************** *** 2807,2813 **** { if (fp == NULL) { ! EMSG2(_(e_nofunc), eap->arg); return; } if (fp->uf_calls > 0) --- 2807,2814 ---- { if (fp == NULL) { ! if (!eap->forceit) ! EMSG2(_(e_nofunc), eap->arg); return; } if (fp->uf_calls > 0) *** ../vim-8.0.0654/src/ex_cmds.h 2017-04-10 21:46:33.442970106 +0200 --- src/ex_cmds.h 2017-06-22 16:39:32.020204662 +0200 *************** *** 426,432 **** NEEDARG|WORD1|TRLBAR|CMDWIN, ADDR_LINES), EX(CMD_delfunction, "delfunction", ex_delfunction, ! NEEDARG|WORD1|CMDWIN, ADDR_LINES), EX(CMD_display, "display", ex_display, EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN, --- 426,432 ---- NEEDARG|WORD1|TRLBAR|CMDWIN, ADDR_LINES), EX(CMD_delfunction, "delfunction", ex_delfunction, ! BANG|NEEDARG|WORD1|CMDWIN, ADDR_LINES), EX(CMD_display, "display", ex_display, EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN, *** ../vim-8.0.0654/src/testdir/test_vimscript.vim 2017-06-22 19:11:45.011344824 +0200 --- src/testdir/test_vimscript.vim 2017-06-22 19:14:56.133796658 +0200 *************** *** 1390,1395 **** --- 1390,1405 ---- set verbose=0 endfunc + func Test_delfunction_force() + delfunc! Xtest + delfunc! Xtest + func Xtest() + echo 'nothing' + endfunc + delfunc! Xtest + delfunc! Xtest + endfunc + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=4 tw=80 fdm=marker *** ../vim-8.0.0654/src/version.c 2017-06-22 19:11:45.015344791 +0200 --- src/version.c 2017-06-22 19:13:37.026437118 +0200 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 655, /**/ -- Time is money. Especially if you make clocks. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///