Re: [vim/vim] patch 9.2.XXXX: multiline dictionaries in :command and :autocmd cause E488 (PR #21073)

h_east (Vim Github Repository) <[email protected]>
Newsgroups gmane.editors.vim.devel
Message-ID <vim/vim/pull/21073/[email protected]>
h-east left a comment (vim/vim#21073)

Please hold off on merging this.

I do not think we should take this patch, and it is better to say why than to
have the points above fixed first.

A trailing `{` cannot be classified without parsing the argument.  It can open
a dictionary, a lambda body or a command block, and it can also be part of
`normal! {`, of a string, or of a pattern.  This patch draws the line at four
characters before the curly.  The next report will be about `[{`, then about a
nested dictionary, then about a `{` inside a string.  Each of those is
fixable, and the boundary stays impossible to state in the documentation.

That looseness is what 9.2.0908 removed.  Before it, any line ending in `{`
started a block, which is why `normal! {` was taken for one (#20918) and why
the dictionary in #21070 happened to work.  Restoring one half of it brings
back the part that cannot be defined.

The documented answer already exists.  |vim9-line-continuation| says that a
command used as the argument of another command needs a backslash, and a
dictionary closed on the same line was never affected:

```vim
command! -nargs=0 Foo call Bar('x', {'key': 'value'})

command! -nargs=0 Foo call Bar('x', {
      \ 'key': 'value',
      \ })
```

That note currently names only `:windo`.  I will add `:command` and
`:autocmd` to it, with tests for the form above.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/21073#issuecomment-5318168983
You are receiving this because you are subscribed to this thread.

Message ID: <vim/vim/pull/21073/[email protected]>

-- 
-- 
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].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/21073/c5318168983%40github.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.