On 12-Jan-13 21:32:34 +0900, ZyX wrote:

> [7 lines deleted]
> Added [defaults] argument to :function
> 
> It serves same purpose as “emulate -L zsh” at the start of zsh functions: 
> making
> function less configuration-dependant.
> 
> [16 lines deleted]
> +                     When the [defaults] argument is added, some intrusive
> +                     options are temporary reset to their default values in
> +                     order to make scripting easier and less user
> +                     configuration dependant: 'cpoptions', 'gdefault',
> +                     'ignorecase', 'magic', 'remap', 'selection',
> +                     'startofline', 'virtualedit', 'wrapscan'.
> [221 lines deleted]

I like the idea, as dealing with all the different options is indeed painful for
script writers. On the other hand, it's not that by setting this flag, you can
now completely forget about the differences; it depends on what your function is
actually doing, there may be other options affecting your functions, and
sometime you do want to observe e.g. the 'ignorecase' setting.

Add to that that for backwards compatibility, scripts have to accommodate the
various settings for a long time to come, and it's less helpful - at least in
the near time frame.

Also note that resetting 'selection' may help with making and modifying a
selection entirely within your function, but based on my experience, when you
want to work on an existing selection made by the user or leave a selection
behind (as in a text object), you have to consider the actual 'selection' value,
as the end position '> is not automatically adjusted when the option changes.

-- regards, ingo

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

Raspunde prin e-mail lui