2017-06-19 12:41 GMT+03:00 Björn Linse <[email protected]>:
> vim --cmd "$(printf 'func! XX()\nechomsg "aa"\nendfunc')"
>  works fine but
> vim --cmd "$(printf 'func! XX()\nechomsg "aa"\nendfunc\ncall XX()')"
>  does not. One would expect at least an error about 'trailing characters' as 
> vim does in some similar situations, expect for 'endfunc "comment' (and 
> perhaps also allow 'endfunc FuncName' if someone does that already, but I 
> haven't seen it)

As I said in referenced discussion basically one needs to adapt to
`endfunction!` (with bang) and `endfunction " comment`. The patch
there does just that, though I have not tested it.

It has a flaw of not giving a warning on the code like

    function F()
    endfunction " Comment
    call F()

should it be executed via `:execute {multiline string}`, but given
that `execute {multiline string}` or other similar places (`-c`,
`--cmd`, Neovim API (`nvim_command()`), `execute({multiline string})`)
do not normally have any comments this should be OK.

It may be not the only or the best way to fix things though.

BTW, I have recently cloned all 5208 repositories belonging to
https://github.com/vim-scripts so am capable of performing searches on
the codebase, though they are going to take way too long time (and
obviously do not touch plugins nobody bothered to post to vim.org).
The resulting ~/tmp/vim-scripts directory surprisingly ended only with
less then a GiB space though (979M according to `du -hs`). Currently
running

    ag '^\s*endf(?:u(?:n(?:c(?:t(?:i(?:o(?:n)?)?)?)?)?)?)?\b!?[
\t]*(?!")\S' ~/tmp/vim-scripts

which should gather some data on the matter (`ag` is an alias to `ag
--case-sensitive`, I never need and actually hate the default).

So long it appears that `:endfunction funcname` is actually being
used: incomplete search revealed

```
/home/zyx/tmp/vim-scripts/4NT-Bundle.git/autoload/btm.vim:161:endfunction
btm#User_Complete
/home/zyx/tmp/vim-scripts/accurev.git/plugin/accurev.vim:5006:endfunction :}}}
/home/zyx/tmp/vim-scripts/accurev.git/plugin/accurev.vim:5014:endfunction :}}}
/home/zyx/tmp/vim-scripts/accurev.git/plugin/accurev.vim:5021:endfunction :}}}
/home/zyx/tmp/vim-scripts/accurev.git/plugin/accurev.vim:5036:endfunction :}}}
/home/zyx/tmp/vim-scripts/accurev.git/plugin/accurev.vim:5044:endfunction :}}}
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:279:endfunction
ada#Word
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:316:endfunction
ada#List_Tag
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:345:endfunction
ada#Jump_Tag
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:362:endfunction
ada#InsertBackspace
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:401:endfunction
ada#User_Complete
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:409:endfunction
ada#Completion
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:416:endfunction
ada#Completion_End
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:432:endfunction
ada#Create_Tags
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:476:endfunction
ada#Switch_Session
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:527:
endfunction ada#Pretty_Print_Folding     " }}}2
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:544:endfunction
ada#Switch_Syntax_Option
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/ada.vim:612:endfunction
ada#Map_Popup
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/adacomplete.vim:99:endfunction
adacomplete#Complete
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/decada.vim:30:endfunction
decada#Unit_Name     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/decada.vim:41:endfunction
decada#Build     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/decada.vim:52:endfunction
decada#Set_Session     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/decada.vim:65:endfunction
decada#New     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/gnat.vim:36:endfunction
gnat#Make     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/gnat.vim:40:endfunction
gnat#Make     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/gnat.vim:44:endfunction
gnat#Find     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/gnat.vim:52:endfunction
gnat#Tags     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/gnat.vim:91:endfunction
gnat#Set_Project_File     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/gnat.vim:96:endfunction
gnat#Get_Command     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/gnat.vim:104:endfunction
gnat#Set_Session     " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/gnat.vim:125:endfunction
gnat#New  " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/autoload/gnat.vim:137:endfunction
gnat#Insert_Tags_Header  " }}}1
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/indent/ada.vim:89:endfunction
MainBlockIndent
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/indent/ada.vim:133:endfunction
EndBlockIndent
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/indent/ada.vim:172:endfunction
StatementIndent
/home/zyx/tmp/vim-scripts/Ada-Bundle.git/indent/ada.vim:293:endfunction
GetAdaIndent
/home/zyx/tmp/vim-scripts/autoloadadacomplete.vim.git/ftplugin/adacomplete.vim:90:
   endfunction adacomplete#Complete
/home/zyx/tmp/vim-scripts/Buffergator.git/autoload/buffergator.vim:329:endfunction!
/home/zyx/tmp/vim-scripts/Buffergator.git/autoload/buffergator.vim:337:endfunction!
/home/zyx/tmp/vim-scripts/cbackup.vim.git/plugin/cbackup.vim:55:
endfunction Do_Purge
/home/zyx/tmp/vim-scripts/cbackup.vim.git/plugin/cbackup.vim:84:
  endfunction Make_Backup_Dir
/home/zyx/tmp/vim-scripts/cbackup.vim.git/plugin/cbackup.vim:93:
  endfunction s:Get_Version
/home/zyx/tmp/vim-scripts/cbackup.vim.git/plugin/cbackup.vim:105:
   endfunction s:Version_Compare
/home/zyx/tmp/vim-scripts/cbackup.vim.git/plugin/cbackup.vim:127:
   endfunction Set_Backup
/home/zyx/tmp/vim-scripts/cmake.vim--Alcin.git/autoload/cmake/commands.vim:159:endfunction!
/home/zyx/tmp/vim-scripts/cmake.vim--Alcin.git/autoload/cmake/commands.vim:204:endfunction!
/home/zyx/tmp/vim-scripts/cmake.vim--Alcin.git/autoload/cmake/flags.vim:27:endfunction!
/home/zyx/tmp/vim-scripts/cmake.vim--Alcin.git/autoload/cmake/flags.vim:41:endfunction!
/home/zyx/tmp/vim-scripts/cmake.vim--Alcin.git/autoload/cmake/targets.vim:11:endfunc!
/home/zyx/tmp/vim-scripts/cmake.vim--Alcin.git/autoload/cmake/targets.vim:28:endfunc!
/home/zyx/tmp/vim-scripts/cmake.vim--Alcin.git/autoload/cmake/targets.vim:49:endfunc!
/home/zyx/tmp/vim-scripts/cmake.vim--Alcin.git/autoload/cmake/targets.vim:108:endfunc!
/home/zyx/tmp/vim-scripts/cmake.vim--Alcin.git/autoload/cmake/targets.vim:123:endfunc!
/home/zyx/tmp/vim-scripts/cmake.vim--Alcin.git/autoload/cmake/targets.vim:152:endfunc!
/home/zyx/tmp/vim-scripts/cmakeref.git/doc/cmakecmds.txt:841:
/home/zyx/tmp/vim-scripts/cmakeref.git/doc/cmakecmds.txt:842:
/home/zyx/tmp/vim-scripts/cmakeref.git/doc/cmakecmds.txt:843:
/home/zyx/tmp/vim-scripts/cmakeref.git/doc/cmakecmds.txt:844:endfunction
                             *endfunction*
/home/zyx/tmp/vim-scripts/ColorSchemeMenuMaker.git/plugin/ColorSchemeMenuMaker.vim:315:endfunction
}}}
/home/zyx/tmp/vim-scripts/compilergnat.vim.git/compiler/gnat.vim:39:
 endfunction Make
/home/zyx/tmp/vim-scripts/cream-vimabbrev.git/plugin/cream-vimabbrev.vim:1073:
/home/zyx/tmp/vim-scripts/cream-vimabbrev.git/plugin/cream-vimabbrev.vim:1074:endfunction
1}}}
/home/zyx/tmp/vim-scripts/ctrlp-cmdpalette.git/autoload/ctrlp/internal_commands.txt:146:endfunction\t:endf[unction]
end of a user function
/home/zyx/tmp/vim-scripts/d.vim--Suhoverhov.git/after/ftplugin/d.vim:70:endfunction
s:Autoimport
/home/zyx/tmp/vim-scripts/d.vim--Suhoverhov.git/after/ftplugin/d.vim:124:
endfunction Compare " }}}
/home/zyx/tmp/vim-scripts/d.vim--Suhoverhov.git/after/ftplugin/d.vim:129:
endfunction GetPackage " }}}
/home/zyx/tmp/vim-scripts/d.vim--Suhoverhov.git/after/ftplugin/d.vim:153:endfunction
OrganizeImports
/home/zyx/tmp/vim-scripts/d.vim--Suhoverhov.git/autoload/omni/d/complete.vim:46:endfunction
omni#d#complete#Complete
/home/zyx/tmp/vim-scripts/drawing.vim.git/plugin/drawing.vim:198:endf!
/home/zyx/tmp/vim-scripts/DrawIt.git/autoload/DrawIt.vim:2771:endf!
```

>
> Some discussion in 
> https://github.com/neovim/neovim/pull/6844#issuecomment-309213209 and below
>
> --
> --
> 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].
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui