Trigger OptionSet autocommand on entering diff mode

79 views
Skip to first unread message

Christian Brabandt

unread,
Jul 7, 2017, 10:35:47 AM7/7/17
to vim...@vim.org
Bram,
currently, when entering diff mode, the OptionSet autocommand is not
called.

The attached patch changes that, so that a user can set specific options
only for diffmode.

Also the oldstyle test was converted to a new style test (and a small
bug in the oldstyle test was fixed).

Please see also the commit description in the attached patch for more
information.

And while I was writing the test, I noticed that test_override() was
missing from usr_41.txt, so I added it there as well.

Best,
Christian
0001-Trigger-OptionSet-on-entering-diffmode.patch

Bram Moolenaar

unread,
Jul 7, 2017, 10:46:19 AM7/7/17
to vim...@googlegroups.com, Christian Brabandt, vim...@vim.org
Thanks.

Did you check that something nasty in the autocommand, such as closing
the buffer, doesn't cause trouble?

--
I have a watch cat! Just break in and she'll watch.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Jul 7, 2017, 12:06:37 PM7/7/17
to vim...@googlegroups.com, vim...@vim.org

On Fr, 07 Jul 2017, Bram Moolenaar wrote:

> Did you check that something nasty in the autocommand, such as closing
> the buffer, doesn't cause trouble?

This version does, by setting curbuf_locked. That makes at least my
initial test:
au OptionSet diff :close
not fail (and still enters diff mode). (previously it would segfault.)

Best,
Christian
--
Traue den Menschen doch etwas mehr, sie sind wohl manchmal besser als
wir meinen.
-- S. Gontard
0001-Trigger-OptionSet-on-entering-diffmode.patch
Reply all
Reply to author
Forward
0 new messages