Patch 8.2.2772
Problem:    Problems when restoring 'runtimepath' from a session file.
Solution:   Add the "skiprtp" item in 'sessionoptions'.
Files:      runtime/doc/options.txt, src/session.c, src/optionstr.c,
            src/option.h, src/vim.h, src/option.c,
            src/testdir/test_mksession.vim


*** ../vim-8.2.2771/runtime/doc/options.txt     2021-03-29 20:49:01.482055371 
+0200
--- runtime/doc/options.txt     2021-04-16 19:33:33.503111856 +0200
***************
*** 6507,6512 ****
--- 6511,6517 ----
                        global values for local options)
           options      all options and mappings (also global values for local
                        options)
+          skiprtp      exclude 'runtimepath' from the options
           resize       size of the Vim window: 'lines' and 'columns'
           sesdir       the directory in which the session file is located
                        will become the current directory (useful with
*** ../vim-8.2.2771/src/session.c       2021-03-13 13:52:29.813470884 +0100
--- src/session.c       2021-04-16 19:45:01.457421093 +0200
***************
*** 1225,1232 ****
                || (eap->cmdidx == CMD_mksession
                    && (*flagp & SSOP_OPTIONS)))
  #endif
            failed |= (makemap(fd, NULL) == FAIL
!                                  || makeset(fd, OPT_GLOBAL, FALSE) == FAIL);
  
  #ifdef FEAT_SESSION
        if (!failed && view_session)
--- 1225,1240 ----
                || (eap->cmdidx == CMD_mksession
                    && (*flagp & SSOP_OPTIONS)))
  #endif
+       {
+           int flags = OPT_GLOBAL;
+ 
+ #ifdef FEAT_SESSION
+           if (eap->cmdidx == CMD_mksession && (*flagp & SSOP_SKIP_RTP))
+               flags |= OPT_SKIPRTP;
+ #endif
            failed |= (makemap(fd, NULL) == FAIL
!                                        || makeset(fd, flags, FALSE) == FAIL);
!       }
  
  #ifdef FEAT_SESSION
        if (!failed && view_session)
*** ../vim-8.2.2771/src/optionstr.c     2021-03-10 13:39:46.322350547 +0100
--- src/optionstr.c     2021-04-16 19:38:05.054600372 +0200
***************
*** 34,43 ****
                                 "undo", "jump", NULL};
  #endif
  #ifdef FEAT_SESSION
! // Also used for 'viewoptions'!
  static char *(p_ssop_values[]) = {"buffers", "winpos", "resize", "winsize",
      "localoptions", "options", "help", "blank", "globals", "slash", "unix",
!     "sesdir", "curdir", "folds", "cursor", "tabpages", "terminal", NULL};
  #endif
  // Keep in sync with SWB_ flags in option.h
  static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", 
"vsplit", "uselast", NULL};
--- 34,44 ----
                                 "undo", "jump", NULL};
  #endif
  #ifdef FEAT_SESSION
! // Also used for 'viewoptions'!  Keep in sync with SSOP_ flags.
  static char *(p_ssop_values[]) = {"buffers", "winpos", "resize", "winsize",
      "localoptions", "options", "help", "blank", "globals", "slash", "unix",
!     "sesdir", "curdir", "folds", "cursor", "tabpages", "terminal", "skiprtp",
!     NULL};
  #endif
  // Keep in sync with SWB_ flags in option.h
  static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", 
"vsplit", "uselast", NULL};
*** ../vim-8.2.2771/src/option.h        2021-03-29 20:49:01.486055361 +0200
--- src/option.h        2021-04-16 19:44:10.669582326 +0200
***************
*** 864,869 ****
--- 864,870 ----
  # define SSOP_CURSOR          0x4000
  # define SSOP_TABPAGES                0x8000
  # define SSOP_TERMINAL                0x10000
+ # define SSOP_SKIP_RTP                0x20000
  #endif
  EXTERN char_u *p_sh;          // 'shell'
  EXTERN char_u *p_shcf;        // 'shellcmdflag'
*** ../vim-8.2.2771/src/vim.h   2021-04-13 21:47:59.544306690 +0200
--- src/vim.h   2021-04-16 19:40:48.426274317 +0200
***************
*** 1201,1206 ****
--- 1201,1207 ----
  #define OPT_NOWIN     0x20    // don't set window-local options
  #define OPT_ONECOLUMN 0x40    // list options one per line
  #define OPT_NO_REDRAW 0x80    // ignore redraw flags on option
+ #define OPT_SKIPRTP   0x100   // "skiprtp" in 'sessionoptions'
  
  // Magic chars used in confirm dialog strings
  #define DLG_BUTTON_SEP        '\n'
*** ../vim-8.2.2771/src/option.c        2021-03-10 13:39:46.322350547 +0100
--- src/option.c        2021-04-16 19:49:48.684575884 +0200
***************
*** 4615,4620 ****
--- 4615,4623 ----
            if ((opt_flags & OPT_GLOBAL) && optval_default(p, varp, p_cp))
                continue;
  
+           if ((opt_flags & OPT_SKIPRTP) && p->var == (char_u *)&p_rtp)
+               continue;
+ 
            round = 2;
            if (p->indir != PV_NONE)
            {
*** ../vim-8.2.2771/src/testdir/test_mksession.vim      2021-04-04 
15:28:55.509067733 +0200
--- src/testdir/test_mksession.vim      2021-04-16 19:57:06.895422586 +0200
***************
*** 131,136 ****
--- 131,162 ----
    set sessionoptions&
  endfunc
  
+ def Test_mksession_skiprtp()
+   mksession! Xtest_mks.out
+   var found = 0
+   for line in readfile('Xtest_mks.out')
+     if line =~ 'set runtimepath'
+       found = 1
+       break
+     endif
+   endfor
+   assert_equal(1, found)
+   delete('Xtest_mks.out')
+ 
+   set sessionoptions+=skiprtp
+   mksession! Xtest_mks.out
+   found = 0
+   for line in readfile('Xtest_mks.out')
+     if line =~ 'set runtimepath'
+       found = 1
+       break
+     endif
+   endfor
+   assert_equal(0, found)
+   delete('Xtest_mks.out')
+   set sessionoptions&
+ enddef
+ 
  func Test_mksession_winheight()
    new
    set winheight=10
*** ../vim-8.2.2771/src/version.c       2021-04-15 22:13:36.074160750 +0200
--- src/version.c       2021-04-16 19:57:27.735370215 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2772,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
109. You actually read -- and enjoy -- lists like this.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202104161758.13GHwlHS388198%40masaka.moolenaar.net.

Raspunde prin e-mail lui