diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-06-22 19:15:24 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-06-22 19:15:24 +0200 |
commit | d6abcd154cdc6a8dd4b7c6ccad37617ea8a1b4aa (patch) | |
tree | 746839083abe888f4424f18c38ac634eec06981b | |
parent | 663bb2331626944cea156374858131fcd323b9e9 (diff) |
patch 8.0.0655: not easy to make sure a function does not existv8.0.0655
Problem: Not easy to make sure a function does not exist.
Solution: Add ! as an optional argument to :delfunc.
-rw-r--r-- | src/ex_cmds.h | 2 | ||||
-rw-r--r-- | src/testdir/test_vimscript.vim | 10 | ||||
-rw-r--r-- | src/userfunc.c | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 15 insertions, 2 deletions
diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 531bd0e16f..519cd0811e 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -426,7 +426,7 @@ EX(CMD_delcommand, "delcommand", ex_delcommand, NEEDARG|WORD1|TRLBAR|CMDWIN, ADDR_LINES), EX(CMD_delfunction, "delfunction", ex_delfunction, - NEEDARG|WORD1|CMDWIN, + BANG|NEEDARG|WORD1|CMDWIN, ADDR_LINES), EX(CMD_display, "display", ex_display, EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN, diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim index 6f5a73fb86..c09e2343b6 100644 --- a/src/testdir/test_vimscript.vim +++ b/src/testdir/test_vimscript.vim @@ -1390,6 +1390,16 @@ func Test_endfunction_trailing() 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 diff --git a/src/userfunc.c b/src/userfunc.c index de089bb68d..34da2ef4b6 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -2807,7 +2807,8 @@ ex_delfunction(exarg_T *eap) { if (fp == NULL) { - EMSG2(_(e_nofunc), eap->arg); + if (!eap->forceit) + EMSG2(_(e_nofunc), eap->arg); return; } if (fp->uf_calls > 0) diff --git a/src/version.c b/src/version.c index 1e7d648618..533660fa05 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 655, +/**/ 654, /**/ 653, |