Am 08.05.2017 um 22:28 schrieb Gary Johnson:
On 2017-05-08, 'Andy Wokula' via vim_dev wrote:
Am 08.05.2017 um 12:53 schrieb Bram Moolenaar:
For flexibility this needs to work recursively.  We could do something
like:

        let saved_options = options_save()
        ... do your stuff ...
        call options_restore(saved_options)

The options being saved should be small to keep this efficient.  We need
to make a list of the ones that are useful, such as 'ignorecase' and
'gdefault'.

What about a different approach:

Have a mode (for debugging only) in which builtin commands and
functions complain when options they use are not at the default
value.  This way the script writer learns which options need to be
set and restored.

Problems usually occur not with the options the script writer has
set to non-default values, but with options the script user has set
to non-default values.  This mode is not going to tell the writer
which options users may have set.

I hit the Send button, then it hit me ... right.

The safest approach, and the one most considerate of the user, is
for the plugin to save and restore the current value of any option
it depends on and sets.

But the question remains how to most easily and certainly find out
*which* options to set.  It should be more transparent which commands
(and functions) are affected by which options.

When everybody knows that for sure (maybe via dedicated help page?)
        :command        affected by  'option', ...
        ...
        function()      affected by  'option', ...
        ...
        h               affected by 'whichwrap', ...

then there could be a helper which traces executed (builtin) commands
and functions along a given way of execution, eg within the scope of a
modifier command, and fills a v:variable ... something like that.
Sounds like a lot of work ... each builtin command and function would
need to support it.
And :normal commands (e.g. `h' affected by 'whichwrap') are probably not
included.  Maybe `:normal h' is included, but not `feedkeys("h")' (out of
modifier command scope).

--
Andy

--
--
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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui