vim-patch:8.0.0655: not easy to make sure a function does not exist

Problem:    Not easy to make sure a function does not exist.
Solution:   Add ! as an optional argument to :delfunc.

https://github.com/vim/vim/commit/d6abcd154cdc6a8dd4b7c6ccad37617ea8a1b4aa
This commit is contained in:
Justin M. Keyes
2018-01-21 18:42:45 +01:00
parent 52778d62fc
commit a185ab70fd
3 changed files with 14 additions and 2 deletions
+3 -1
View File
@@ -20863,7 +20863,9 @@ void ex_delfunction(exarg_T *eap)
if (!eap->skip) {
if (fp == NULL) {
EMSG2(_(e_nofunc), eap->arg);
if (!eap->forceit) {
EMSG2(_(e_nofunc), eap->arg);
}
return;
}
if (fp->uf_calls > 0) {
+1 -1
View File
@@ -692,7 +692,7 @@ return {
},
{
command='delcommand',
flags=bit.bor(NEEDARG, WORD1, TRLBAR, CMDWIN),
flags=bit.bor(BANG, NEEDARG, WORD1, TRLBAR, CMDWIN),
addr_type=ADDR_LINES,
func='ex_delcommand',
},
+10
View File
@@ -1242,6 +1242,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