On 2018-09-19, Bram Moolenaar wrote:
> Gary Johnson wrote:
> 
> > Thanks for adding the DiffUpdated autocommand event.
> > 
> > I've been trying to use the DiffUpdated and OptionSet autocommand
> > events to update some option settings and I think I've found a bug
> > in the OptionSet event: v:option_old and v:option_new are not set
> > when the option is diff.  I'm using Vim 8.1.401.
> > 
> > When I execute the following autocommand definition,
> > 
> >     :autocmd OptionSet diff echo "OptionSet diff" v:option_old v:option_new
> > 
> > followed by
> > 
> >     :set diff
> >     :set nodiff
> > 
> > all I see displayed in the status line for each of those is
> > 
> >     OptionSet diff
> > 
> > but no values for either v:option_old or v:option_new.
> > 
> > Repeating the experiment, but replacing "diff" by "number" yields
> > the expected results:
> > 
> >     OptionSet number 0 1
> >     OptionSet number 1 0
> 
> Well, it works just fine for me.  No idea why it doesn't work for you.

I just tried it again, this time starting vim as

    $ vim -N -u NONE -i NONE

and it works correctly.

I then tried a number of experiments, including inserting
autocommands such as this one among the other "OptionSet diff"
autocommands I've defined.

    autocmd OptionSet diff echo "OptionSet diff A" v:option_old v:option_new

I changed the letter A to a different letter for each autocommand so
that I could tell their outputs apart.

I discovered that the outputs were correct up to a point, then the
values of v:option_old and v:option_new became empty.  That occurred
after the following autocommand.

    autocmd OptionSet diff if &diff && !exists("g:ve") | let g:ve = &ve | set 
ve=all | endif

I don't know what's going on, but something in that autocommand
causes v:option_old and v:option_new to be cleared.

Regards,
Gary

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