Nikolay Pavlov wrote:

> 2017-06-22 20:12 GMT+03:00 Bram Moolenaar <b...@moolenaar.net>:
> >
> > Patch 8.0.0654
> > Problem:    Text found after :endfunction is silently ignored.
> > Solution:   Give a warning if 'verbose' is set.  When | or \n are used,
> >             execute the text as a command.
> > Files:      src/testdir/test_vimscript.vim, src/userfunc.c,
> >             runtime/doc/eval.txt
> 
> [...]
> 
> I am not much fond of the idea of conditionally making code stop
> working. &verbose+&verbosefile combination is supposed to provide a
> user with a log for debugging, not screw up the code (which will be
> done should user e.g. be testing a SourceCmd that does `try | source |
> finally`).

Right.  I used an error message to make the test work, but it's not a
good solution.  I'll make it a warning message.

> Additionally `\n` is not supposed to occur inside an argument at all.
> You are throwing an implementation detail of `:execute` into a face of
> user and I do not remember it being actually documented. Not in `:h
> :execute` for sure. There is some documentation at `:h :|` which talks
> about replacing it with `<C-v><CR>`, but that’s all I found and it
> does not mention `\n` or special treatment of a newline inside
> `:execute`.

The use of \n is required, as the code searching for :endfunction cannot
parse commands and can easily handle | in a wrong way.  This didn't
change.  I thought this was documented somewhere, but can't find it now.
I'll add an example.


> The third reason why I would actually proceed with my way is that
> `:endfunction | next command` is not going to work reliably for a
> pretty long period of time: e.g. debian jessie (oldstable) was there
> for two years and it had 7.4.488, new stable was only released a
> couple of days ago and contains 8.0.0197. These consideration could be
> something to discard if `endfunction | cmd` was actually useful, but I
> do not see it being such. At least not unless you want to allow
> writing `:function Test() | echo 1 | endfunction | call Test()`: this
> would prove handy for some of my one-liners, but in the current state
> it does not work because of `:function` and not because of
> `:endfunction`.

The question came up with it didn't work and was silently ignored.  Now,
we could keep silently ignoring it, give an error or make it work.
Giving an error is not reliable, since there are so many uses already
where it gets in the way.  Making it work appears to be the best
long-term solution.  And yeah, it will take a while until widely spread
plugins can use it.

-- 
hundred-and-one symptoms of being an internet addict:
71. You wonder how people walk

 /// 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