Patch 7.4.1658
Problem:    A plugin does not know when VimEnter autocommands were already
            triggered.
Solution:   Add the v:vim_did_enter variable.
Files:      src/eval.c, src/main.c, src/vim.h, src/testdir/test_autocmd.vim,
            src/testdir/test_alot.vim, runtime/doc/autocmd.txt,
            runtime/doc/eval.txt


*** ../vim-7.4.1657/src/eval.c  2016-03-26 18:20:36.949052940 +0100
--- src/eval.c  2016-03-26 19:52:15.324681887 +0100
***************
*** 372,377 ****
--- 372,378 ----
      {VV_NAME("true",           VAR_SPECIAL), VV_RO},
      {VV_NAME("null",           VAR_SPECIAL), VV_RO},
      {VV_NAME("none",           VAR_SPECIAL), VV_RO},
+     {VV_NAME("vim_did_enter",  VAR_NUMBER), VV_RO},
  };
  
  /* shorthand */
*** ../vim-7.4.1657/src/main.c  2016-03-19 22:11:47.424674965 +0100
--- src/main.c  2016-03-26 19:53:32.543894305 +0100
***************
*** 969,974 ****
--- 969,977 ----
      if (p_im)
        need_start_insertmode = TRUE;
  
+ #ifdef FEAT_EVAL
+     set_vim_var_nr(VV_VIM_DID_ENTER, 1L);
+ #endif
  #ifdef FEAT_AUTOCMD
      apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf);
      TIME_MSG("VimEnter autocommands");
*** ../vim-7.4.1657/src/vim.h   2016-03-19 22:11:47.440674791 +0100
--- src/vim.h   2016-03-26 19:54:29.839309878 +0100
***************
*** 1869,1875 ****
  #define VV_TRUE               64
  #define VV_NULL               65
  #define VV_NONE               66
! #define VV_LEN                67      /* number of v: vars */
  
  /* used for v_number in VAR_SPECIAL */
  #define VVAL_FALSE    0L
--- 1869,1876 ----
  #define VV_TRUE               64
  #define VV_NULL               65
  #define VV_NONE               66
! #define VV_VIM_DID_ENTER 67
! #define VV_LEN                68      /* number of v: vars */
  
  /* used for v_number in VAR_SPECIAL */
  #define VVAL_FALSE    0L
*** ../vim-7.4.1657/src/testdir/test_autocmd.vim        2016-03-26 
20:58:12.436405922 +0100
--- src/testdir/test_autocmd.vim        2016-03-26 20:53:35.119229095 +0100
***************
*** 0 ****
--- 1,8 ----
+ " Tests for autocommands
+ 
+ func Test_vim_did_enter()
+   call assert_false(v:vim_did_enter)
+ 
+   " This script will never reach the main loop, can't check if v:vim_did_enter
+   " becomes one.
+ endfunc
*** ../vim-7.4.1657/src/testdir/test_alot.vim   2016-03-25 17:55:24.966112156 
+0100
--- src/testdir/test_alot.vim   2016-03-26 19:58:01.349155450 +0100
***************
*** 2,7 ****
--- 2,8 ----
  " This makes testing go faster, since Vim doesn't need to restart.
  
  source test_assign.vim
+ source test_autocmd.vim
  source test_cursor_func.vim
  source test_delete.vim
  source test_ex_undo.vim
*** ../vim-7.4.1657/runtime/doc/autocmd.txt     2015-07-17 17:38:00.555399737 
+0200
--- runtime/doc/autocmd.txt     2016-03-26 20:00:34.623594678 +0100
***************
*** 904,910 ****
                                loading .vimrc files, executing the "-c cmd"
                                arguments, creating all windows and loading
                                the buffers in them.
!                                                       *VimLeave*
  VimLeave                      Before exiting Vim, just after writing the
                                .viminfo file.  Executed only once, like
                                VimLeavePre.
--- 918,932 ----
                                loading .vimrc files, executing the "-c cmd"
                                arguments, creating all windows and loading
                                the buffers in them.
!                               Just before this event is triggered the
!                               |v:vim_did_enter| variable is set, so that you
!                               can do: >
!                                  if v:vim_did_enter
!                                    call s:init()
!                                  else
!                                    au VimEnter * call s:init()
!                                  endif
! <                                                     *VimLeave*
  VimLeave                      Before exiting Vim, just after writing the
                                .viminfo file.  Executed only once, like
                                VimLeavePre.
*** ../vim-7.4.1657/runtime/doc/eval.txt        2016-03-20 20:56:56.040282977 
+0100
--- runtime/doc/eval.txt        2016-03-26 20:04:48.841005116 +0100
***************
*** 1745,1750 ****
--- 1762,1771 ----
                version 5.0 and 5.1 may have a patch 123, but these are
                completely different.
  
+                               *v:vim_did_enter* *vim_did_enter-variable*
+ v:vim_did_enter       Zero until most of startup is done.  It is set to one 
just
+               before |VimEnter| autocommands are triggered.
+ 
                                        *v:warningmsg* *warningmsg-variable*
  v:warningmsg  Last given warning message.  It's allowed to set this variable.
  
*** ../vim-7.4.1657/src/version.c       2016-03-26 19:41:43.875118885 +0100
--- src/version.c       2016-03-26 20:57:38.932747069 +0100
***************
*** 750,751 ****
--- 750,753 ----
  {   /* Add new patch number below this line */
+ /**/
+     1658,
  /**/

-- 
In a world without fences, who needs Gates and Windows?

 /// Bram Moolenaar -- [email protected] -- 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    ///

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