On Mon, 12 Jun 2006, A.J.Mechelynck wrote:

Gerald Lai wrote:
On Sun, 11 Jun 2006, A.J.Mechelynck wrote:

Gerald Lai wrote:
Hi all,

[On Windows Vim 7.0, binary at ftp://ftp.vim.org/pub/vim/pc/gvim70.exe]
I'm having trouble getting the example in

:help complete()

to work. When I hit <F5> in Insert mode, I get this:

Error detected while processing function ListMonths:
line 1:
E523: Not allowed here

I have :set nosecure.
Having this instead fixes the problem:

inoremap <F5> <C-r>=ListMonths()<CR>

Looks like a bug. I wasn't sure if this has been fixed.

Looks to me like a documentation bug. I believe you got it right, and the helpfile got it wrong.

Best regards,

Does this mean that <expr> isn't allowed for complete()? It mentioned at
the top of ":help complete()" that both :map-<expr> and <C-r>= were
allowed. Isn't

  imap <expr> <F5> MyFunction()


  imap <F5> <C-r>=MyFunction()<CR>

pretty much the same? Or at the very least, the same in terms of
security (see :help E523)?

Sorry, the <expr> in the given example had escaped me. They /ought to/ be synonymous, but the <C-R>= mechanism is older; <expr> is new in version 7, which means perhaps it hasn't yet got all its bugs ironed out.

":help E523" is the same as ":help 'secure'". Are you sure this option isn't set unbeknownst to you? When the error happens, what does ":verbose set secure?" (without the quotes but with the question mark) reply? If it does return "nosecure" then I guess it's a bug.

Yes, it does return "nosecure". Everything unchanged, when I tried the
<C-r>= version, it works. It looks like a bug from my side. Do you
notice the same? Anybody else?

Reply via email to