Nikolay Pavlov wrote:

> 2017-06-19 13:11 GMT+03:00 Nikolay Aleksandrovich Pavlov <zyx....@gmail.com>:
> > 2017-06-19 13:08 GMT+03:00 Nikolay Aleksandrovich Pavlov 
> > <zyx....@gmail.com>:
> >> 2017-06-19 12:41 GMT+03:00 Björn Linse <bjorn.li...@gmail.com>:
> >>> 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
> >
> > Had to modify search, replacing `!?` with `!?+` to take out lines like
> > `"endfunction!"`.
> 
> Here are the search results below. Copy in
> https://gist.github.com/7a791445da0fb7def8a74ba703d60e51.
> 
> Appear to be rather minor: out of more then five thousand repositories
> got only 167 matches and at least some of them are irrelevant. Mostly
> `endfunction FuncName`, but some are `endfunction; …` or `endfunction:
> …` for whatever reason. While I am in favor of disregarding them to
> keep full enough compatibility one should just skip after
> `endfunction` to next newline or bar (latter only unless there is a
> comment character before it to be safe) and error out should there
> something non-whitespace (which here includes space, tab, NL and CR)
> be found after, not that somebody will expect `endfunction
> NextCommand` actually work.

Thanks for checking that.

I am not aware of users running into the problem of unexpectedly having
their command after :endfunction not working.  Actually, the most common
would be to use:
        endfunc | another command

We can give an error for that.  But I don't think anyone expects this to
work:
        endfunc another command

Giving an error for that would just be annoying for existing plugins.
To help debugging, we could give a warning if 'verbose' is non-zero.

-- 
hundred-and-one symptoms of being an internet addict:
46. Your wife makes a new rule: "The computer cannot come to bed."

 /// Bram Moolenaar -- b...@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    ///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui