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