Patch 7.4.1840
Problem:    When using packages an "after" directory cannot be used.
Solution:   Add the "after" directory of the package to 'runtimepath' if it
            exists.
Files:      src/ex_cmds2.c, src/testdir/test_packadd.vim


*** ../vim-7.4.1839/src/ex_cmds2.c      2016-05-17 17:45:24.307426095 +0200
--- src/ex_cmds2.c      2016-05-24 19:28:55.735110807 +0200
***************
*** 3326,3338 ****
      int           keep;
      int           oldlen;
      int           addlen;
      char_u  *ffname = fix_fname(fname);
  
      if (ffname == NULL)
        return;
      if (cookie != &APP_LOAD && strstr((char *)p_rtp, (char *)ffname) == NULL)
      {
!       /* directory not in 'runtimepath', add it */
        p4 = p3 = p2 = p1 = get_past_head(ffname);
        for (p = p1; *p; mb_ptr_adv(p))
            if (vim_ispathsep_nocolon(*p))
--- 3326,3340 ----
      int           keep;
      int           oldlen;
      int           addlen;
+     char_u  *afterdir;
+     int           afterlen = 0;
      char_u  *ffname = fix_fname(fname);
  
      if (ffname == NULL)
        return;
      if (cookie != &APP_LOAD && strstr((char *)p_rtp, (char *)ffname) == NULL)
      {
!       /* directory is not yet in 'runtimepath', add it */
        p4 = p3 = p2 = p1 = get_past_head(ffname);
        for (p = p1; *p; mb_ptr_adv(p))
            if (vim_ispathsep_nocolon(*p))
***************
*** 3360,3379 ****
        }
        *p4 = c;
  
        oldlen = (int)STRLEN(p_rtp);
!       addlen = (int)STRLEN(ffname);
!       new_rtp = alloc(oldlen + addlen + 2);
        if (new_rtp == NULL)
            goto theend;
        keep = (int)(insp - p_rtp);
        mch_memmove(new_rtp, p_rtp, keep);
        new_rtp[keep] = ',';
!       mch_memmove(new_rtp + keep + 1, ffname, addlen + 1);
        if (p_rtp[keep] != NUL)
!           mch_memmove(new_rtp + keep + 1 + addlen, p_rtp + keep,
                                                           oldlen - keep + 1);
        set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
        vim_free(new_rtp);
      }
  
      if (cookie != &APP_ADD_DIR)
--- 3362,3392 ----
        }
        *p4 = c;
  
+       /* check if rtp/pack/name/start/name/after exists */
+       afterdir = concat_fnames(ffname, (char_u *)"after", TRUE);
+       if (afterdir != NULL && mch_isdir(afterdir))
+           afterlen = STRLEN(afterdir) + 1; /* add one for comma */
+ 
        oldlen = (int)STRLEN(p_rtp);
!       addlen = (int)STRLEN(ffname) + 1; /* add one for comma */
!       new_rtp = alloc(oldlen + addlen + afterlen + 1); /* add one for NUL */
        if (new_rtp == NULL)
            goto theend;
        keep = (int)(insp - p_rtp);
        mch_memmove(new_rtp, p_rtp, keep);
        new_rtp[keep] = ',';
!       mch_memmove(new_rtp + keep + 1, ffname, addlen);
        if (p_rtp[keep] != NUL)
!           mch_memmove(new_rtp + keep + addlen, p_rtp + keep,
                                                           oldlen - keep + 1);
+       if (afterlen > 0)
+       {
+           STRCAT(new_rtp, ",");
+           STRCAT(new_rtp, afterdir);
+       }
        set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
        vim_free(new_rtp);
+       vim_free(afterdir);
      }
  
      if (cookie != &APP_ADD_DIR)
*** ../vim-7.4.1839/src/testdir/test_packadd.vim        2016-04-05 
21:12:55.975983365 +0200
--- src/testdir/test_packadd.vim        2016-05-24 19:30:39.127109384 +0200
***************
*** 13,18 ****
--- 13,19 ----
  func Test_packadd()
    call mkdir(s:plugdir . '/plugin/also', 'p')
    call mkdir(s:plugdir . '/ftdetect', 'p')
+   call mkdir(s:plugdir . '/after', 'p')
    set rtp&
    let rtp = &rtp
    filetype on
***************
*** 35,41 ****
    call assert_equal(77, g:plugin_also_works)
    call assert_equal(17, g:ftdetect_works)
    call assert_true(len(&rtp) > len(rtp))
!   call assert_true(&rtp =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
  
    " Check exception
    call assert_fails("packadd directorynotfound", 'E919:')
--- 36,43 ----
    call assert_equal(77, g:plugin_also_works)
    call assert_equal(17, g:ftdetect_works)
    call assert_true(len(&rtp) > len(rtp))
!   call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
!   call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/opt/mytest/after$')
  
    " Check exception
    call assert_fails("packadd directorynotfound", 'E919:')
*** ../vim-7.4.1839/src/version.c       2016-05-24 18:36:48.103153830 +0200
--- src/version.c       2016-05-24 19:36:41.471104400 +0200
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     1840,
  /**/

-- 
An operatingsystem is just a name you give to the rest of bloating
idiosyncratic machine-based-features you left out of your editor.
                        (author unknown)

 /// Bram Moolenaar -- b...@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    ///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui