I was a little surprised to see that setting formatexpr from a
modeline works, since many other -expr options are disallowed in a
modeline. It looks like this is allowed because Vim remembers it got
set from a modeline and therefore executes it in the sandbox.
But :help 'formatexpr' says:
The expression may be evaluated in the |sandbox|, see
|sandbox-option|. That stops the option from working, since changing
the buffer text is not allowed.
So, why allow setting formatexpr at all from a modeline? It won't work
properly if it does happen.
On a related note, it might be worth noting for options like
formatexpr and foldexpr which can be set in a modeline but will then
run in the sandbox, that setting it from a modeline WILL cause it to
run in the sandbox, not that it "may be evaluated in the sandbox"
without any indication of why it would run in the sandbox.
--
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