Karsten Hopp d4ef63
To: vim_dev@googlegroups.com
Karsten Hopp d4ef63
Subject: Patch 7.4.833
Karsten Hopp d4ef63
Fcc: outbox
Karsten Hopp d4ef63
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp d4ef63
Mime-Version: 1.0
Karsten Hopp d4ef63
Content-Type: text/plain; charset=UTF-8
Karsten Hopp d4ef63
Content-Transfer-Encoding: 8bit
Karsten Hopp d4ef63
------------
Karsten Hopp d4ef63
Karsten Hopp d4ef63
Patch 7.4.833
Karsten Hopp d4ef63
Problem:    More side effects of ":set all&" are missing. (Björn Linse)
Karsten Hopp d4ef63
Solution:   Call didset_options() and add didset_options2() to collect more
Karsten Hopp d4ef63
            side effects to take care of.  Still not everything...
Karsten Hopp d4ef63
Files:      src/option.c
Karsten Hopp d4ef63
Karsten Hopp d4ef63
Karsten Hopp d4ef63
*** ../vim-7.4.832/src/option.c	2015-08-25 12:56:22.618312165 +0200
Karsten Hopp d4ef63
--- src/option.c	2015-08-25 15:29:31.402326593 +0200
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 3079,3084 ****
Karsten Hopp d4ef63
--- 3079,3085 ----
Karsten Hopp d4ef63
  #endif
Karsten Hopp d4ef63
  static char_u *option_expand __ARGS((int opt_idx, char_u *val));
Karsten Hopp d4ef63
  static void didset_options __ARGS((void));
Karsten Hopp d4ef63
+ static void didset_options2 __ARGS((void));
Karsten Hopp d4ef63
  static void check_string_option __ARGS((char_u **pp));
Karsten Hopp d4ef63
  #if defined(FEAT_EVAL) || defined(PROTO)
Karsten Hopp d4ef63
  static long_u *insecure_flag __ARGS((int opt_idx, int opt_flags));
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 3096,3101 ****
Karsten Hopp d4ef63
--- 3097,3103 ----
Karsten Hopp d4ef63
  static char_u *check_clipboard_option __ARGS((void));
Karsten Hopp d4ef63
  #endif
Karsten Hopp d4ef63
  #ifdef FEAT_SPELL
Karsten Hopp d4ef63
+ static char_u *did_set_spell_option __ARGS((int is_spellfile));
Karsten Hopp d4ef63
  static char_u *compile_cap_prog __ARGS((synblock_T *synblock));
Karsten Hopp d4ef63
  #endif
Karsten Hopp d4ef63
  #ifdef FEAT_EVAL
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 3376,3392 ****
Karsten Hopp d4ef63
      didset_options();
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
  #ifdef FEAT_SPELL
Karsten Hopp d4ef63
!     /* Use the current chartab for the generic chartab. */
Karsten Hopp d4ef63
      init_spell_chartab();
Karsten Hopp d4ef63
  #endif
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
- #ifdef FEAT_LINEBREAK
Karsten Hopp d4ef63
-     /*
Karsten Hopp d4ef63
-      * initialize the table for 'breakat'.
Karsten Hopp d4ef63
-      */
Karsten Hopp d4ef63
-     fill_breakat_flags();
Karsten Hopp d4ef63
- #endif
Karsten Hopp d4ef63
- 
Karsten Hopp d4ef63
      /*
Karsten Hopp d4ef63
       * Expand environment variables and things like "~" for the defaults.
Karsten Hopp d4ef63
       * If option_expand() returns non-NULL the variable is expanded.  This can
Karsten Hopp d4ef63
--- 3378,3388 ----
Karsten Hopp d4ef63
      didset_options();
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
  #ifdef FEAT_SPELL
Karsten Hopp d4ef63
!     /* Use the current chartab for the generic chartab. This is not in
Karsten Hopp d4ef63
!      * didset_options() because it only depends on 'encoding'. */
Karsten Hopp d4ef63
      init_spell_chartab();
Karsten Hopp d4ef63
  #endif
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
      /*
Karsten Hopp d4ef63
       * Expand environment variables and things like "~" for the defaults.
Karsten Hopp d4ef63
       * If option_expand() returns non-NULL the variable is expanded.  This can
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 3418,3431 ****
Karsten Hopp d4ef63
  	}
Karsten Hopp d4ef63
      }
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
-     /* Initialize the highlight_attr[] table. */
Karsten Hopp d4ef63
-     highlight_changed();
Karsten Hopp d4ef63
- 
Karsten Hopp d4ef63
      save_file_ff(curbuf);	/* Buffer is unchanged */
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
-     /* Parse default for 'wildmode'  */
Karsten Hopp d4ef63
-     check_opt_wim();
Karsten Hopp d4ef63
- 
Karsten Hopp d4ef63
  #if defined(FEAT_ARABIC)
Karsten Hopp d4ef63
      /* Detect use of mlterm.
Karsten Hopp d4ef63
       * Mlterm is a terminal emulator akin to xterm that has some special
Karsten Hopp d4ef63
--- 3414,3421 ----
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 3437,3451 ****
Karsten Hopp d4ef63
  	set_option_value((char_u *)"tbidi", 1L, NULL, 0);
Karsten Hopp d4ef63
  #endif
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
! #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
Karsten Hopp d4ef63
!     /* Parse default for 'fillchars'. */
Karsten Hopp d4ef63
!     (void)set_chars_option(&p_fcs);
Karsten Hopp d4ef63
! #endif
Karsten Hopp d4ef63
! 
Karsten Hopp d4ef63
! #ifdef FEAT_CLIPBOARD
Karsten Hopp d4ef63
!     /* Parse default for 'clipboard' */
Karsten Hopp d4ef63
!     (void)check_clipboard_option();
Karsten Hopp d4ef63
! #endif
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
  #ifdef FEAT_MBYTE
Karsten Hopp d4ef63
  # if defined(WIN3264) && defined(FEAT_GETTEXT)
Karsten Hopp d4ef63
--- 3427,3433 ----
Karsten Hopp d4ef63
  	set_option_value((char_u *)"tbidi", 1L, NULL, 0);
Karsten Hopp d4ef63
  #endif
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
!     didset_options2();
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
  #ifdef FEAT_MBYTE
Karsten Hopp d4ef63
  # if defined(WIN3264) && defined(FEAT_GETTEXT)
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 3670,3676 ****
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
      for (i = 0; !istermoption(&options[i]); i++)
Karsten Hopp d4ef63
  	if (!(options[i].flags & P_NODEFAULT)
Karsten Hopp d4ef63
! 		&& (opt_flags == 0 || options[i].var != (char_u *)&p_enc))
Karsten Hopp d4ef63
  	    set_option_default(i, opt_flags, p_cp);
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
  #ifdef FEAT_WINDOWS
Karsten Hopp d4ef63
--- 3652,3661 ----
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
      for (i = 0; !istermoption(&options[i]); i++)
Karsten Hopp d4ef63
  	if (!(options[i].flags & P_NODEFAULT)
Karsten Hopp d4ef63
! 		&& (opt_flags == 0
Karsten Hopp d4ef63
! 		    || (options[i].var != (char_u *)&p_enc
Karsten Hopp d4ef63
! 			&& options[i].var != (char_u *)&p_cm
Karsten Hopp d4ef63
! 			&& options[i].var != (char_u *)&p_key)))
Karsten Hopp d4ef63
  	    set_option_default(i, opt_flags, p_cp);
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
  #ifdef FEAT_WINDOWS
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 4206,4211 ****
Karsten Hopp d4ef63
--- 4191,4198 ----
Karsten Hopp d4ef63
  		++arg;
Karsten Hopp d4ef63
  		/* Only for :set command set global value of local options. */
Karsten Hopp d4ef63
  		set_options_default(OPT_FREE | opt_flags);
Karsten Hopp d4ef63
+ 		didset_options();
Karsten Hopp d4ef63
+ 		didset_options2();
Karsten Hopp d4ef63
  		redraw_all_later(CLEAR);
Karsten Hopp d4ef63
  	    }
Karsten Hopp d4ef63
  	    else
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 5348,5353 ****
Karsten Hopp d4ef63
--- 5335,5341 ----
Karsten Hopp d4ef63
      (void)spell_check_msm();
Karsten Hopp d4ef63
      (void)spell_check_sps();
Karsten Hopp d4ef63
      (void)compile_cap_prog(curwin->w_s);
Karsten Hopp d4ef63
+     (void)did_set_spell_option(TRUE);
Karsten Hopp d4ef63
  #endif
Karsten Hopp d4ef63
  #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
Karsten Hopp d4ef63
      (void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE);
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 5362,5367 ****
Karsten Hopp d4ef63
--- 5350,5384 ----
Karsten Hopp d4ef63
  #ifdef FEAT_LINEBREAK
Karsten Hopp d4ef63
      briopt_check(curwin);
Karsten Hopp d4ef63
  #endif
Karsten Hopp d4ef63
+ #ifdef FEAT_LINEBREAK
Karsten Hopp d4ef63
+     /* initialize the table for 'breakat'. */
Karsten Hopp d4ef63
+     fill_breakat_flags();
Karsten Hopp d4ef63
+ #endif
Karsten Hopp d4ef63
+ 
Karsten Hopp d4ef63
+ }
Karsten Hopp d4ef63
+ 
Karsten Hopp d4ef63
+ /*
Karsten Hopp d4ef63
+  * More side effects of setting options.
Karsten Hopp d4ef63
+  */
Karsten Hopp d4ef63
+     static void
Karsten Hopp d4ef63
+ didset_options2()
Karsten Hopp d4ef63
+ {
Karsten Hopp d4ef63
+     /* Initialize the highlight_attr[] table. */
Karsten Hopp d4ef63
+     (void)highlight_changed();
Karsten Hopp d4ef63
+ 
Karsten Hopp d4ef63
+     /* Parse default for 'wildmode'  */
Karsten Hopp d4ef63
+     check_opt_wim();
Karsten Hopp d4ef63
+ 
Karsten Hopp d4ef63
+     (void)set_chars_option(&p_lcs);
Karsten Hopp d4ef63
+ #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
Karsten Hopp d4ef63
+     /* Parse default for 'fillchars'. */
Karsten Hopp d4ef63
+     (void)set_chars_option(&p_fcs);
Karsten Hopp d4ef63
+ #endif
Karsten Hopp d4ef63
+ 
Karsten Hopp d4ef63
+ #ifdef FEAT_CLIPBOARD
Karsten Hopp d4ef63
+     /* Parse default for 'clipboard' */
Karsten Hopp d4ef63
+     (void)check_clipboard_option();
Karsten Hopp d4ef63
+ #endif
Karsten Hopp d4ef63
  }
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
  /*
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 6794,6821 ****
Karsten Hopp d4ef63
      else if (varp == &(curwin->w_s->b_p_spl)
Karsten Hopp d4ef63
  	    || varp == &(curwin->w_s->b_p_spf))
Karsten Hopp d4ef63
      {
Karsten Hopp d4ef63
! 	win_T	    *wp;
Karsten Hopp d4ef63
! 	int	    l;
Karsten Hopp d4ef63
! 
Karsten Hopp d4ef63
! 	if (varp == &(curwin->w_s->b_p_spf))
Karsten Hopp d4ef63
! 	{
Karsten Hopp d4ef63
! 	    l = (int)STRLEN(curwin->w_s->b_p_spf);
Karsten Hopp d4ef63
! 	    if (l > 0 && (l < 4 || STRCMP(curwin->w_s->b_p_spf + l - 4,
Karsten Hopp d4ef63
! 								".add") != 0))
Karsten Hopp d4ef63
! 		errmsg = e_invarg;
Karsten Hopp d4ef63
! 	}
Karsten Hopp d4ef63
! 
Karsten Hopp d4ef63
! 	if (errmsg == NULL)
Karsten Hopp d4ef63
! 	{
Karsten Hopp d4ef63
! 	    FOR_ALL_WINDOWS(wp)
Karsten Hopp d4ef63
! 		if (wp->w_buffer == curbuf && wp->w_p_spell)
Karsten Hopp d4ef63
! 		{
Karsten Hopp d4ef63
! 		    errmsg = did_set_spelllang(wp);
Karsten Hopp d4ef63
! # ifdef FEAT_WINDOWS
Karsten Hopp d4ef63
! 		    break;
Karsten Hopp d4ef63
! # endif
Karsten Hopp d4ef63
! 		}
Karsten Hopp d4ef63
! 	}
Karsten Hopp d4ef63
      }
Karsten Hopp d4ef63
      /* When 'spellcapcheck' is set compile the regexp program. */
Karsten Hopp d4ef63
      else if (varp == &(curwin->w_s->b_p_spc))
Karsten Hopp d4ef63
--- 6811,6817 ----
Karsten Hopp d4ef63
      else if (varp == &(curwin->w_s->b_p_spl)
Karsten Hopp d4ef63
  	    || varp == &(curwin->w_s->b_p_spf))
Karsten Hopp d4ef63
      {
Karsten Hopp d4ef63
! 	errmsg = did_set_spell_option(varp == &(curwin->w_s->b_p_spf));
Karsten Hopp d4ef63
      }
Karsten Hopp d4ef63
      /* When 'spellcapcheck' is set compile the regexp program. */
Karsten Hopp d4ef63
      else if (varp == &(curwin->w_s->b_p_spc))
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 7687,7692 ****
Karsten Hopp d4ef63
--- 7683,7718 ----
Karsten Hopp d4ef63
  #endif
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
  #ifdef FEAT_SPELL
Karsten Hopp d4ef63
+     static char_u *
Karsten Hopp d4ef63
+ did_set_spell_option(is_spellfile)
Karsten Hopp d4ef63
+     int		is_spellfile;
Karsten Hopp d4ef63
+ {
Karsten Hopp d4ef63
+     char_u  *errmsg = NULL;
Karsten Hopp d4ef63
+     win_T   *wp;
Karsten Hopp d4ef63
+     int	    l;
Karsten Hopp d4ef63
+ 
Karsten Hopp d4ef63
+     if (is_spellfile)
Karsten Hopp d4ef63
+     {
Karsten Hopp d4ef63
+ 	l = (int)STRLEN(curwin->w_s->b_p_spf);
Karsten Hopp d4ef63
+ 	if (l > 0 && (l < 4
Karsten Hopp d4ef63
+ 			|| STRCMP(curwin->w_s->b_p_spf + l - 4, ".add") != 0))
Karsten Hopp d4ef63
+ 	    errmsg = e_invarg;
Karsten Hopp d4ef63
+     }
Karsten Hopp d4ef63
+ 
Karsten Hopp d4ef63
+     if (errmsg == NULL)
Karsten Hopp d4ef63
+     {
Karsten Hopp d4ef63
+ 	FOR_ALL_WINDOWS(wp)
Karsten Hopp d4ef63
+ 	    if (wp->w_buffer == curbuf && wp->w_p_spell)
Karsten Hopp d4ef63
+ 	    {
Karsten Hopp d4ef63
+ 		errmsg = did_set_spelllang(wp);
Karsten Hopp d4ef63
+ # ifdef FEAT_WINDOWS
Karsten Hopp d4ef63
+ 		break;
Karsten Hopp d4ef63
+ # endif
Karsten Hopp d4ef63
+ 	    }
Karsten Hopp d4ef63
+     }
Karsten Hopp d4ef63
+     return errmsg;
Karsten Hopp d4ef63
+ }
Karsten Hopp d4ef63
+ 
Karsten Hopp d4ef63
  /*
Karsten Hopp d4ef63
   * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
Karsten Hopp d4ef63
   * Return error message when failed, NULL when OK.
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 11741,11746 ****
Karsten Hopp d4ef63
--- 11767,11773 ----
Karsten Hopp d4ef63
  	    if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF)))
Karsten Hopp d4ef63
  		set_option_default(opt_idx, OPT_FREE, FALSE);
Karsten Hopp d4ef63
  	didset_options();
Karsten Hopp d4ef63
+ 	didset_options2();
Karsten Hopp d4ef63
      }
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
      if (fname != NULL)
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 11829,11834 ****
Karsten Hopp d4ef63
--- 11856,11862 ----
Karsten Hopp d4ef63
  		|| (!(options[opt_idx].flags & P_VI_DEF) && !p_cp))
Karsten Hopp d4ef63
  	    set_option_default(opt_idx, OPT_FREE, p_cp);
Karsten Hopp d4ef63
      didset_options();
Karsten Hopp d4ef63
+     didset_options2();
Karsten Hopp d4ef63
  }
Karsten Hopp d4ef63
  
Karsten Hopp d4ef63
  #ifdef FEAT_LINEBREAK
Karsten Hopp d4ef63
*** ../vim-7.4.832/src/version.c	2015-08-25 14:21:14.013470670 +0200
Karsten Hopp d4ef63
--- src/version.c	2015-08-25 14:47:04.281087542 +0200
Karsten Hopp d4ef63
***************
Karsten Hopp d4ef63
*** 743,744 ****
Karsten Hopp d4ef63
--- 743,746 ----
Karsten Hopp d4ef63
  {   /* Add new patch number below this line */
Karsten Hopp d4ef63
+ /**/
Karsten Hopp d4ef63
+     833,
Karsten Hopp d4ef63
  /**/
Karsten Hopp d4ef63
Karsten Hopp d4ef63
-- 
Karsten Hopp d4ef63
You can be stopped by the police for biking over 65 miles per hour.
Karsten Hopp d4ef63
You are not allowed to walk across a street on your hands.
Karsten Hopp d4ef63
		[real standing laws in Connecticut, United States of America]
Karsten Hopp d4ef63
Karsten Hopp d4ef63
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp d4ef63
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp d4ef63
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp d4ef63
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///