Thursday, July 22, 2010

Questions on formatexpr, sandbox and errors

function FormatExpr()
this line should cause an error
[code here...]
endfunction

set formatexpr=FormatExpr()
set tw=20
Hi all,

I was writting my own formatexpr (please, see
http://vimgcwsyntax.google.com/), but found some difficulties that I
summarize below:

1. First and most important one is that I don't get any errors that
occur inside my FormatExpr() function when it is called from
formatexpr (although I get errors when I call it from : ). Why? Is
it because it is executed in a sandbox environment? Is it possible
to disable this feature? If not, what is the common way to debug
formatexpr functions? I attached a simplified .vimrc, that shows the
problem.

2. :he formatexpr says: "The expression may be evaluated in the
|sandbox|". It says *may be*. Sorry, English is not my native
language... When you use may, it means that it is optional? If so,
how disable/enable that?

3. :he sandbox says: "These items are not allowed in the sanbox: ...
- changing the buffer text", but from a formatexpr function, it is
always changed with append() and setline(). How to explain that?

Vim version here is 7.2.411.

Thank you!

--
Silas Silva

--
You received this message from the "vim_use" 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

No comments: