Karsten Hopp 5c0aa4
To: vim-dev@vim.org
Karsten Hopp 5c0aa4
Subject: patch 7.1.099
Karsten Hopp 5c0aa4
Fcc: outbox
Karsten Hopp 5c0aa4
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 5c0aa4
Mime-Version: 1.0
Karsten Hopp 5c0aa4
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 5c0aa4
Content-Transfer-Encoding: 8bit
Karsten Hopp 5c0aa4
------------
Karsten Hopp 5c0aa4
Karsten Hopp 5c0aa4
Patch 7.1.099
Karsten Hopp 5c0aa4
Problem:    When the 'keymap' and 'paste' options have a non-default value,
Karsten Hopp 5c0aa4
	    ":mkexrc" and ":mksession" do not correctly set the options.
Karsten Hopp 5c0aa4
Solution:   Set the options with side effects before other options.
Karsten Hopp 5c0aa4
Files:	    src/option.c
Karsten Hopp 5c0aa4
Karsten Hopp 5c0aa4
 
Karsten Hopp 5c0aa4
*** ../vim-7.1.098/src/option.c	Thu Sep  6 13:32:53 2007
Karsten Hopp 5c0aa4
--- src/option.c	Wed Sep  5 22:34:27 2007
Karsten Hopp 5c0aa4
***************
Karsten Hopp 5c0aa4
*** 427,432 ****
Karsten Hopp 5c0aa4
--- 427,434 ----
Karsten Hopp 5c0aa4
  #define P_NOGLOB       0x100000L/* do not use local value for global vimrc */
Karsten Hopp 5c0aa4
  #define P_NFNAME       0x200000L/* only normal file name chars allowed */
Karsten Hopp 5c0aa4
  #define P_INSECURE     0x400000L/* option was set from a modeline */
Karsten Hopp 5c0aa4
+ #define P_PRI_MKRC     0x800000L/* priority for :mkvimrc (setting option has
Karsten Hopp 5c0aa4
+ 				   side effects) */
Karsten Hopp 5c0aa4
  
Karsten Hopp 5c0aa4
  #define ISK_LATIN1  (char_u *)"@,48-57,_,192-255"
Karsten Hopp 5c0aa4
  
Karsten Hopp 5c0aa4
***************
Karsten Hopp 5c0aa4
*** 773,778 ****
Karsten Hopp 5c0aa4
--- 775,782 ----
Karsten Hopp 5c0aa4
  			    {(char_u *)0L, (char_u *)0L}
Karsten Hopp 5c0aa4
  #endif
Karsten Hopp 5c0aa4
  			    },
Karsten Hopp 5c0aa4
+ 			    /* P_PRI_MKRC isn't needed here, optval_default()
Karsten Hopp 5c0aa4
+ 			     * always returns TRUE for 'compatible' */
Karsten Hopp 5c0aa4
      {"compatible",  "cp",   P_BOOL|P_RALL,
Karsten Hopp 5c0aa4
  			    (char_u *)&p_cp, PV_NONE,
Karsten Hopp 5c0aa4
  			    {(char_u *)TRUE, (char_u *)FALSE}},
Karsten Hopp 5c0aa4
***************
Karsten Hopp 5c0aa4
*** 1515,1521 ****
Karsten Hopp 5c0aa4
  			    {(char_u *)0L, (char_u *)0L}
Karsten Hopp 5c0aa4
  #endif
Karsten Hopp 5c0aa4
  			    },
Karsten Hopp 5c0aa4
!     {"keymap",	    "kmp",  P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME,
Karsten Hopp 5c0aa4
  #ifdef FEAT_KEYMAP
Karsten Hopp 5c0aa4
  			    (char_u *)&p_keymap, PV_KMAP,
Karsten Hopp 5c0aa4
  			    {(char_u *)"", (char_u *)0L}
Karsten Hopp 5c0aa4
--- 1519,1525 ----
Karsten Hopp 5c0aa4
  			    {(char_u *)0L, (char_u *)0L}
Karsten Hopp 5c0aa4
  #endif
Karsten Hopp 5c0aa4
  			    },
Karsten Hopp 5c0aa4
!     {"keymap",	    "kmp",  P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME|P_PRI_MKRC,
Karsten Hopp 5c0aa4
  #ifdef FEAT_KEYMAP
Karsten Hopp 5c0aa4
  			    (char_u *)&p_keymap, PV_KMAP,
Karsten Hopp 5c0aa4
  			    {(char_u *)"", (char_u *)0L}
Karsten Hopp 5c0aa4
***************
Karsten Hopp 5c0aa4
*** 1836,1842 ****
Karsten Hopp 5c0aa4
      {"paragraphs",  "para", P_STRING|P_VI_DEF,
Karsten Hopp 5c0aa4
  			    (char_u *)&p_para, PV_NONE,
Karsten Hopp 5c0aa4
  			    {(char_u *)"IPLPPPQPP LIpplpipbp", (char_u *)0L}},
Karsten Hopp 5c0aa4
!     {"paste",	    NULL,   P_BOOL|P_VI_DEF,
Karsten Hopp 5c0aa4
  			    (char_u *)&p_paste, PV_NONE,
Karsten Hopp 5c0aa4
  			    {(char_u *)FALSE, (char_u *)0L}},
Karsten Hopp 5c0aa4
      {"pastetoggle", "pt",   P_STRING|P_VI_DEF,
Karsten Hopp 5c0aa4
--- 1840,1846 ----
Karsten Hopp 5c0aa4
      {"paragraphs",  "para", P_STRING|P_VI_DEF,
Karsten Hopp 5c0aa4
  			    (char_u *)&p_para, PV_NONE,
Karsten Hopp 5c0aa4
  			    {(char_u *)"IPLPPPQPP LIpplpipbp", (char_u *)0L}},
Karsten Hopp 5c0aa4
!     {"paste",	    NULL,   P_BOOL|P_VI_DEF|P_PRI_MKRC,
Karsten Hopp 5c0aa4
  			    (char_u *)&p_paste, PV_NONE,
Karsten Hopp 5c0aa4
  			    {(char_u *)FALSE, (char_u *)0L}},
Karsten Hopp 5c0aa4
      {"pastetoggle", "pt",   P_STRING|P_VI_DEF,
Karsten Hopp 5c0aa4
***************
Karsten Hopp 5c0aa4
*** 8535,8547 ****
Karsten Hopp 5c0aa4
      char_u		*varp_local = NULL;	/* fresh value */
Karsten Hopp 5c0aa4
      char		*cmd;
Karsten Hopp 5c0aa4
      int			round;
Karsten Hopp 5c0aa4
  
Karsten Hopp 5c0aa4
      /*
Karsten Hopp 5c0aa4
       * The options that don't have a default (terminal name, columns, lines)
Karsten Hopp 5c0aa4
       * are never written.  Terminal options are also not written.
Karsten Hopp 5c0aa4
       */
Karsten Hopp 5c0aa4
!     for (p = &options[0]; !istermoption(p); p++)
Karsten Hopp 5c0aa4
! 	if (!(p->flags & P_NO_MKRC) && !istermoption(p))
Karsten Hopp 5c0aa4
  	{
Karsten Hopp 5c0aa4
  	    /* skip global option when only doing locals */
Karsten Hopp 5c0aa4
  	    if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL))
Karsten Hopp 5c0aa4
--- 8539,8558 ----
Karsten Hopp 5c0aa4
      char_u		*varp_local = NULL;	/* fresh value */
Karsten Hopp 5c0aa4
      char		*cmd;
Karsten Hopp 5c0aa4
      int			round;
Karsten Hopp 5c0aa4
+     int			pri;
Karsten Hopp 5c0aa4
  
Karsten Hopp 5c0aa4
      /*
Karsten Hopp 5c0aa4
       * The options that don't have a default (terminal name, columns, lines)
Karsten Hopp 5c0aa4
       * are never written.  Terminal options are also not written.
Karsten Hopp 5c0aa4
+      * Do the loop over "options[]" twice: once for options with the
Karsten Hopp 5c0aa4
+      * P_PRI_MKRC flag and once without.
Karsten Hopp 5c0aa4
       */
Karsten Hopp 5c0aa4
!     for (pri = 1; pri >= 0; --pri)
Karsten Hopp 5c0aa4
!     {
Karsten Hopp 5c0aa4
!       for (p = &options[0]; !istermoption(p); p++)
Karsten Hopp 5c0aa4
! 	if (!(p->flags & P_NO_MKRC)
Karsten Hopp 5c0aa4
! 		&& !istermoption(p)
Karsten Hopp 5c0aa4
! 		&& ((pri == 1) == ((p->flags & P_PRI_MKRC) != 0)))
Karsten Hopp 5c0aa4
  	{
Karsten Hopp 5c0aa4
  	    /* skip global option when only doing locals */
Karsten Hopp 5c0aa4
  	    if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL))
Karsten Hopp 5c0aa4
***************
Karsten Hopp 5c0aa4
*** 8637,8642 ****
Karsten Hopp 5c0aa4
--- 8648,8654 ----
Karsten Hopp 5c0aa4
  		}
Karsten Hopp 5c0aa4
  	    }
Karsten Hopp 5c0aa4
  	}
Karsten Hopp 5c0aa4
+     }
Karsten Hopp 5c0aa4
      return OK;
Karsten Hopp 5c0aa4
  }
Karsten Hopp 5c0aa4
  
Karsten Hopp 5c0aa4
*** ../vim-7.1.098/src/version.c	Thu Sep  6 14:25:50 2007
Karsten Hopp 5c0aa4
--- src/version.c	Thu Sep  6 16:32:31 2007
Karsten Hopp 5c0aa4
***************
Karsten Hopp 5c0aa4
*** 668,669 ****
Karsten Hopp 5c0aa4
--- 668,671 ----
Karsten Hopp 5c0aa4
  {   /* Add new patch number below this line */
Karsten Hopp 5c0aa4
+ /**/
Karsten Hopp 5c0aa4
+     99,
Karsten Hopp 5c0aa4
  /**/
Karsten Hopp 5c0aa4
Karsten Hopp 5c0aa4
-- 
Karsten Hopp 5c0aa4
Not too long ago, a keyboard was something to make music with...
Karsten Hopp 5c0aa4
Karsten Hopp 5c0aa4
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 5c0aa4
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 5c0aa4
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 5c0aa4
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///