Patch 9.0.1366
Problem:    Functions for setting options are in random order.
Solution:   Sort functions alphabetically. (Yegappan Lakshmanan,
            closes #12082)
Files:      src/optionstr.c, src/proto/optionstr.pro


*** ../vim-9.0.1365/src/optionstr.c     2023-02-27 12:47:44.107282452 +0000
--- src/optionstr.c     2023-03-01 12:41:23.179194265 +0000
***************
*** 657,692 ****
  }
  
  /*
!  * The 'term' option is changed.
   */
      static char *
! did_set_term(int *opt_idx, long_u *free_oldval)
  {
!     char *errmsg = NULL;
  
!     if (T_NAME[0] == NUL)
!       errmsg = e_cannot_set_term_to_empty_string;
! #ifdef FEAT_GUI
!     else if (gui.in_use)
!       errmsg = e_cannot_change_term_in_GUI;
!     else if (term_is_gui(T_NAME))
!       errmsg = e_use_gui_to_start_GUI;
  #endif
!     else if (set_termname(T_NAME) == FAIL)
!       errmsg = e_not_found_in_termcap;
!     else
      {
!       // Screen colors may have changed.
!       redraw_later_clear();
  
!       // Both 'term' and 'ttytype' point to T_NAME, only set the
!       // P_ALLOCED flag on 'term'.
!       *opt_idx = findoption((char_u *)"term");
!       if (*opt_idx >= 0)
!           *free_oldval = (get_option_flags(*opt_idx) & P_ALLOCED);
      }
  
!     return errmsg;
  }
  
  /*
--- 657,762 ----
  }
  
  /*
!  * An option that accepts a list of flags is changed.
!  * e.g. 'viewoptions', 'switchbuf', 'casemap', etc.
   */
      static char *
! did_set_opt_flags(char_u *val, char **values, unsigned *flagp, int list)
  {
!     if (opt_strings_flags(val, values, flagp, list) == FAIL)
!       return e_invalid_argument;
  
!     return NULL;
! }
! 
! /*
!  * An option that accepts a list of string values is changed.
!  * e.g. 'nrformats', 'scrollopt', 'wildoptions', etc.
!  */
!     static char *
! did_set_opt_strings(char_u *val, char **values, int list)
! {
!     return did_set_opt_flags(val, values, NULL, list);
! }
! 
! /*
!  * An option which is a list of flags is set.  Valid values are in 'flags'.
!  */
!     static char *
! did_set_option_listflag(char_u *varp, char_u *flags, char *errbuf)
! {
!     char_u    *s;
! 
!     for (s = varp; *s; ++s)
!       if (vim_strchr(flags, *s) == NULL)
!           return illegal_char(errbuf, *s);
! 
!     return NULL;
! }
! 
! /*
!  * The 'ambiwidth' option is changed.
!  */
!     char *
! did_set_ambiwidth(optset_T *args UNUSED)
! {
!     if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
!       return e_invalid_argument;
! 
!     return check_chars_options();
! }
! 
! /*
!  * The 'background' option is changed.
!  */
!     char *
! did_set_background(optset_T *args UNUSED)
! {
!     if (check_opt_strings(p_bg, p_bg_values, FALSE) == FAIL)
!       return e_invalid_argument;
! 
! #ifdef FEAT_EVAL
!     int dark = (*p_bg == 'd');
  #endif
! 
!     init_highlight(FALSE, FALSE);
! 
! #ifdef FEAT_EVAL
!     if (dark != (*p_bg == 'd')
!           && get_var_value((char_u *)"g:colors_name") != NULL)
      {
!       // The color scheme must have set 'background' back to another
!       // value, that's not what we want here.  Disable the color
!       // scheme and set the colors again.
!       do_unlet((char_u *)"g:colors_name", TRUE);
!       free_string_option(p_bg);
!       p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
!       check_string_option(&p_bg);
!       init_highlight(FALSE, FALSE);
!     }
! #endif
! #ifdef FEAT_TERMINAL
!     term_update_colors_all();
! #endif
  
!     return NULL;
! }
! 
! /*
!  * The 'backspace' option is changed.
!  */
!     char *
! did_set_backspace(optset_T *args UNUSED)
! {
!     if (VIM_ISDIGIT(*p_bs))
!     {
!       if (*p_bs > '3' || p_bs[1] != NUL)
!           return e_invalid_argument;
      }
+     else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
+       return e_invalid_argument;
  
!     return NULL;
  }
  
  /*
***************
*** 739,744 ****
--- 809,823 ----
      return NULL;
  }
  
+ /*
+  * The 'belloff' option is changed.
+  */
+     char *
+ did_set_belloff(optset_T *args UNUSED)
+ {
+     return did_set_opt_flags(p_bo, p_bo_values, &bo_flags, TRUE);
+ }
+ 
  #if defined(FEAT_LINEBREAK) || defined(PROTO)
  /*
   * The 'breakindentopt' option is changed.
***************
*** 758,1084 ****
  }
  #endif
  
  /*
!  * The 'isident' or the 'iskeyword' or the 'isprint' or the 'isfname' option 
is
!  * changed.
   */
      char *
! did_set_isopt(optset_T *args)
  {
!     // 'isident', 'iskeyword', 'isprint or 'isfname' option: refill 
g_chartab[]
!     // If the new option is invalid, use old value.
!     // 'lisp' option: refill g_chartab[] for '-' char.
!     if (init_chartab() == FAIL)
!     {
!       args->os_restore_chartab = TRUE;// need to restore the chartab.
!       return e_invalid_argument;      // error in value
!     }
  
      return NULL;
  }
  
  /*
!  * The 'helpfile' option is changed.
   */
      char *
! did_set_helpfile(optset_T *args UNUSED)
  {
!     // May compute new values for $VIM and $VIMRUNTIME
!     if (didset_vim)
!       vim_unsetenv_ext((char_u *)"VIM");
!     if (didset_vimruntime)
!       vim_unsetenv_ext((char_u *)"VIMRUNTIME");
      return NULL;
  }
  
- #if defined(FEAT_SYN_HL) || defined(PROTO)
  /*
!  * The 'colorcolumn' option is changed.
   */
      char *
! did_set_colorcolumn(optset_T *args UNUSED)
  {
!     return check_colorcolumn(curwin);
  }
  
  /*
!  * The 'cursorlineopt' option is changed.
   */
      char *
! did_set_cursorlineopt(optset_T *args)
  {
!     if (*args->os_varp == NUL
!           || fill_culopt_flags(args->os_varp, curwin) != OK)
!       return e_invalid_argument;
  
      return NULL;
  }
  #endif
  
- #if defined(FEAT_MULTI_LANG) || defined(PROTO)
  /*
!  * The 'helplang' option is changed.
   */
      char *
! did_set_helplang(optset_T *args UNUSED)
  {
!     char *errmsg = NULL;
  
!     // Check for "", "ab", "ab,cd", etc.
!     for (char_u *s = p_hlg; *s != NUL; s += 3)
      {
!       if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL))
        {
!           errmsg = e_invalid_argument;
!           break;
        }
!       if (s[2] == NUL)
            break;
      }
  
      return errmsg;
  }
- #endif
  
  /*
!  * The 'highlight' option is changed.
   */
      char *
! did_set_highlight(optset_T *args UNUSED)
  {
!     if (highlight_changed() == FAIL)
!       return e_invalid_argument;      // invalid flags
  
      return NULL;
  }
  
  /*
!  * An option that accepts a list of flags is changed.
!  * e.g. 'viewoptions', 'switchbuf', 'casemap', etc.
   */
!     static char *
! did_set_opt_flags(char_u *val, char **values, unsigned *flagp, int list)
  {
!     if (opt_strings_flags(val, values, flagp, list) == FAIL)
!       return e_invalid_argument;
  
!     return NULL;
! }
  
! /*
!  * An option that accepts a list of string values is changed.
!  * e.g. 'nrformats', 'scrollopt', 'wildoptions', etc.
!  */
!     static char *
! did_set_opt_strings(char_u *val, char **values, int list)
! {
!     return did_set_opt_flags(val, values, NULL, list);
  }
  
  /*
!  * The 'belloff' option is changed.
   */
      char *
! did_set_belloff(optset_T *args UNUSED)
  {
!     return did_set_opt_flags(p_bo, p_bo_values, &bo_flags, TRUE);
! }
  
! /*
!  * The 'casemap' option is changed.
!  */
!     char *
! did_set_casemap(optset_T *args UNUSED)
! {
!     return did_set_opt_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
  }
  
  /*
!  * The 'scrollopt' option is changed.
   */
      char *
! did_set_scrollopt(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_sbo, p_scbopt_values, TRUE);
! }
  
! /*
!  * The 'selectmode' option is changed.
!  */
!     char *
! did_set_selectmode(optset_T *args UNUSED)
! {
!     return did_set_opt_strings(p_slm, p_slm_values, TRUE);
  }
  
  /*
!  * The 'showcmdloc' option is changed.
   */
      char *
! did_set_showcmdloc(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_sloc, p_sloc_values, FALSE);
! }
  
! /*
!  * The 'splitkeep' option is changed.
!  */
!     char *
! did_set_splitkeep(optset_T *args UNUSED)
! {
!     return did_set_opt_strings(p_spk, p_spk_values, FALSE);
  }
  
  /*
!  * The 'swapsync' option is changed.
   */
      char *
! did_set_swapsync(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_sws, p_sws_values, FALSE);
  }
  
  /*
!  * The 'switchbuf' option is changed.
   */
      char *
! did_set_switchbuf(optset_T *args UNUSED)
  {
!     return did_set_opt_flags(p_swb, p_swb_values, &swb_flags, TRUE);
  }
  
! #if defined(FEAT_SESSION) || defined(PROTO)
  /*
!  * The 'sessionoptions' option is changed.
   */
      char *
! did_set_sessionoptions(optset_T *args)
  {
!     if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK)
!       return e_invalid_argument;
!     if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR))
      {
!       // Don't allow both "sesdir" and "curdir".
!       (void)opt_strings_flags(args->os_oldval.string, p_ssop_values,
!                                                       &ssop_flags, TRUE);
!       return e_invalid_argument;
      }
  
      return NULL;
  }
  
  /*
!  * The 'viewoptions' option is changed.
   */
      char *
! did_set_viewoptions(optset_T *args UNUSED)
  {
!     return did_set_opt_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
! }
! #endif
  
! /*
!  * The 'ambiwidth' option is changed.
!  */
!     char *
! did_set_ambiwidth(optset_T *args UNUSED)
! {
!     if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
        return e_invalid_argument;
  
!     return check_chars_options();
  }
  
  /*
!  * The 'background' option is changed.
   */
      char *
! did_set_background(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_bg, p_bg_values, FALSE) == FAIL)
!       return e_invalid_argument;
! 
! #ifdef FEAT_EVAL
!     int dark = (*p_bg == 'd');
! #endif
  
!     init_highlight(FALSE, FALSE);
  
! #ifdef FEAT_EVAL
!     if (dark != (*p_bg == 'd')
!           && get_var_value((char_u *)"g:colors_name") != NULL)
      {
!       // The color scheme must have set 'background' back to another
!       // value, that's not what we want here.  Disable the color
!       // scheme and set the colors again.
!       do_unlet((char_u *)"g:colors_name", TRUE);
!       free_string_option(p_bg);
!       p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
!       check_string_option(&p_bg);
!       init_highlight(FALSE, FALSE);
      }
- #endif
- #ifdef FEAT_TERMINAL
-     term_update_colors_all();
- #endif
  
      return NULL;
  }
  
  /*
!  * The 'wildmode' option is changed.
   */
      char *
! did_set_wildmode(optset_T *args UNUSED)
  {
!     if (check_opt_wim() == FAIL)
        return e_invalid_argument;
      return NULL;
  }
  
  /*
!  * The 'wildoptions' option is changed.
   */
      char *
! did_set_wildoptions(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_wop, p_wop_values, TRUE);
  }
  
! #if defined(FEAT_WAK) || defined(PROTO)
  /*
!  * The 'winaltkeys' option is changed.
   */
      char *
! did_set_winaltkeys(optset_T *args UNUSED)
  {
!     char *errmsg = NULL;
  
!     if (*p_wak == NUL
!           || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
!       errmsg = e_invalid_argument;
! # ifdef FEAT_MENU
! #  if defined(FEAT_GUI_MOTIF)
!     else if (gui.in_use)
!       gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
! #  elif defined(FEAT_GUI_GTK)
!     else if (gui.in_use)
!       gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
! #  endif
! # endif
!     return errmsg;
  }
  #endif
  
  /*
!  * The 'wincolor' option is changed.
   */
      char *
! did_set_wincolor(optset_T *args UNUSED)
  {
! #ifdef FEAT_TERMINAL
!     term_update_wincolor(curwin);
! #endif
      return NULL;
  }
  
--- 837,1243 ----
  }
  #endif
  
+ #if defined(FEAT_BROWSE) || defined(PROTO)
  /*
!  * The 'browsedir' option is changed.
   */
      char *
! did_set_browsedir(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK
!           && !mch_isdir(p_bsdir))
!       return e_invalid_argument;
  
      return NULL;
  }
+ #endif
  
  /*
!  * The 'bufhidden' option is changed.
   */
      char *
! did_set_bufhidden(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(curbuf->b_p_bh, p_bufhidden_values, FALSE);
! }
! 
! /*
!  * The 'buftype' option is changed.
!  */
!     char *
! did_set_buftype(optset_T *args UNUSED)
! {
!     if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK)
!       return e_invalid_argument;
! 
!     if (curwin->w_status_height)
!     {
!       curwin->w_redr_status = TRUE;
!       redraw_later(UPD_VALID);
!     }
!     curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
!     redraw_titles();
! 
      return NULL;
  }
  
  /*
!  * The 'casemap' option is changed.
   */
      char *
! did_set_casemap(optset_T *args UNUSED)
  {
!     return did_set_opt_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
  }
  
  /*
!  * The 'cinoptions' option is changed.
   */
      char *
! did_set_cinoptions(optset_T *args UNUSED)
  {
!     // TODO: recognize errors
!     parse_cino(curbuf);
  
      return NULL;
  }
+ 
+ #if defined(FEAT_SYN_HL) || defined(PROTO)
+ /*
+  * The 'colorcolumn' option is changed.
+  */
+     char *
+ did_set_colorcolumn(optset_T *args UNUSED)
+ {
+     return check_colorcolumn(curwin);
+ }
  #endif
  
  /*
!  * The 'comments' option is changed.
   */
      char *
! did_set_comments(optset_T *args)
  {
!     char_u    *s;
!     char      *errmsg = NULL;
  
!     for (s = args->os_varp; *s; )
      {
!       while (*s && *s != ':')
        {
!           if (vim_strchr((char_u *)COM_ALL, *s) == NULL
!                   && !VIM_ISDIGIT(*s) && *s != '-')
!           {
!               errmsg = illegal_char(args->os_errbuf, *s);
!               break;
!           }
!           ++s;
        }
!       if (*s++ == NUL)
!           errmsg = e_missing_colon;
!       else if (*s == ',' || *s == NUL)
!           errmsg = e_zero_length_string;
!       if (errmsg != NULL)
            break;
+       while (*s && *s != ',')
+       {
+           if (*s == '\\' && s[1] != NUL)
+               ++s;
+           ++s;
+       }
+       s = skip_to_option_part(s);
      }
  
      return errmsg;
  }
  
+ #if defined(FEAT_FOLDING) || defined(PROTO)
  /*
!  * The 'commentstring' option is changed.
   */
      char *
! did_set_commentstring(optset_T *args)
  {
!     if (*args->os_varp != NUL && strstr((char *)args->os_varp, "%s") == NULL)
!       return e_commentstring_must_be_empty_or_contain_str;
  
      return NULL;
  }
+ #endif
  
  /*
!  * The 'complete' option is changed.
   */
!     char *
! did_set_complete(optset_T *args)
  {
!     char_u    *s;
  
!     // check if it is a valid value for 'complete' -- Acevedo
!     for (s = args->os_varp; *s;)
!     {
!       while (*s == ',' || *s == ' ')
!           s++;
!       if (!*s)
!           break;
!       if (vim_strchr((char_u *)".wbuksid]tU", *s) == NULL)
!           return illegal_char(args->os_errbuf, *s);
!       if (*++s != NUL && *s != ',' && *s != ' ')
!       {
!           if (s[-1] == 'k' || s[-1] == 's')
!           {
!               // skip optional filename after 'k' and 's'
!               while (*s && *s != ',' && *s != ' ')
!               {
!                   if (*s == '\\' && s[1] != NUL)
!                       ++s;
!                   ++s;
!               }
!           }
!           else
!           {
!               if (args->os_errbuf != NULL)
!               {
!                   sprintf((char *)args->os_errbuf,
!                           _(e_illegal_character_after_chr), *--s);
!                   return args->os_errbuf;
!               }
!               return "";
!           }
!       }
!     }
  
!     return NULL;
  }
  
  /*
!  * The 'completeopt' option is changed.
   */
      char *
! did_set_completeopt(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK)
!       return e_invalid_argument;
  
!     completeopt_was_set();
!     return NULL;
  }
  
+ #if (defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)) || defined(PROTO)
  /*
!  * The 'completepopup' option is changed.
   */
      char *
! did_set_completepopup(optset_T *args UNUSED)
  {
!     if (parse_completepopup(NULL) == FAIL)
!       return e_invalid_argument;
  
!     popup_close_info();
!     return NULL;
  }
+ #endif
  
+ #if defined(BACKSLASH_IN_FILENAME) || defined(PROTO)
  /*
!  * The 'completeslash' option is changed.
   */
      char *
! did_set_completeslash(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_csl, p_csl_values, FALSE) != OK
!           || check_opt_strings(curbuf->b_p_csl, p_csl_values, FALSE) != OK)
!       return e_invalid_argument;
  
!     return NULL;
  }
+ #endif
  
+ #if defined(FEAT_CONCEAL) || defined(PROTO)
  /*
!  * The 'concealcursor' option is changed.
   */
      char *
! did_set_concealcursor(optset_T *args)
  {
!     return did_set_option_listflag(args->os_varp, (char_u *)COCU_ALL,
!                                                       args->os_errbuf);
  }
+ #endif
  
  /*
!  * The 'cpoptions' option is changed.
   */
      char *
! did_set_cpoptions(optset_T *args)
  {
!     return did_set_option_listflag(args->os_varp, (char_u *)CPO_ALL,
!                                                       args->os_errbuf);
  }
  
! #if defined(FEAT_CRYPT) || defined(PROTO)
  /*
!  * The 'cryptkey' option is changed.
   */
      char *
! did_set_cryptkey(optset_T *args)
  {
!     // Make sure the ":set" command doesn't show the new value in the
!     // history.
!     remove_key_from_history();
! 
!     if (STRCMP(curbuf->b_p_key, args->os_oldval.string) != 0)
      {
!       // Need to update the swapfile.
!       ml_set_crypt_key(curbuf, args->os_oldval.string,
!               *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
!       changed_internal();
      }
  
      return NULL;
  }
  
  /*
!  * The 'cryptmethod' option is changed.
   */
      char *
! did_set_cryptmethod(optset_T *args)
  {
!     char_u  *p;
!     char_u  *s;
  
!     if (args->os_flags & OPT_LOCAL)
!       p = curbuf->b_p_cm;
!     else
!       p = p_cm;
!     if (check_opt_strings(p, p_cm_values, TRUE) != OK)
!       return e_invalid_argument;
!     else if (crypt_self_test() == FAIL)
        return e_invalid_argument;
  
!     // When setting the global value to empty, make it "zip".
!     if (*p_cm == NUL)
!     {
!       free_string_option(p_cm);
!       p_cm = vim_strsave((char_u *)"zip");
!     }
!     // When using ":set cm=name" the local value is going to be empty.
!     // Do that here, otherwise the crypt functions will still use the
!     // local value.
!     if ((args->os_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
!     {
!       free_string_option(curbuf->b_p_cm);
!       curbuf->b_p_cm = empty_option;
!     }
! 
!     // Need to update the swapfile when the effective method changed.
!     // Set "s" to the effective old value, "p" to the effective new
!     // method and compare.
!     if ((args->os_flags & OPT_LOCAL) && *args->os_oldval.string == NUL)
!       s = p_cm;  // was previously using the global value
!     else
!       s = args->os_oldval.string;
!     if (*curbuf->b_p_cm == NUL)
!       p = p_cm;  // is now using the global value
!     else
!       p = curbuf->b_p_cm;
!     if (STRCMP(s, p) != 0)
!       ml_set_crypt_key(curbuf, curbuf->b_p_key, s);
! 
!     // If the global value changes need to update the swapfile for all
!     // buffers using that value.
!     if ((args->os_flags & OPT_GLOBAL)
!           && STRCMP(p_cm, args->os_oldval.string) != 0)
!     {
!       buf_T   *buf;
! 
!       FOR_ALL_BUFFERS(buf)
!           if (buf != curbuf && *buf->b_p_cm == NUL)
!               ml_set_crypt_key(buf, buf->b_p_key, args->os_oldval.string);
!     }
!     return NULL;
  }
+ #endif
  
+ #if (defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)) || defined(PROTO)
  /*
!  * The 'cscopequickfix' option is changed.
   */
      char *
! did_set_cscopequickfix(optset_T *args UNUSED)
  {
!     char_u    *p;
  
!     if (p_csqf == NULL)
!       return NULL;
  
!     p = p_csqf;
!     while (*p != NUL)
      {
!       if (vim_strchr((char_u *)CSQF_CMDS, *p) == NULL
!               || p[1] == NUL
!               || vim_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL
!               || (p[2] != NUL && p[2] != ','))
!           return e_invalid_argument;
!       else if (p[2] == NUL)
!           break;
!       else
!           p += 3;
      }
  
      return NULL;
  }
+ #endif
  
+ #if defined(FEAT_SYN_HL) || defined(PROTO)
  /*
!  * The 'cursorlineopt' option is changed.
   */
      char *
! did_set_cursorlineopt(optset_T *args)
  {
!     if (*args->os_varp == NUL
!           || fill_culopt_flags(args->os_varp, curwin) != OK)
        return e_invalid_argument;
+ 
      return NULL;
  }
+ #endif
  
  /*
!  * The 'debug' option is changed.
   */
      char *
! did_set_debug(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_debug, p_debug_values, TRUE);
  }
  
! #if defined(FEAT_DIFF) || defined(PROTO)
  /*
!  * The 'diffopt' option is changed.
   */
      char *
! did_set_diffopt(optset_T *args UNUSED)
  {
!     if (diffopt_changed() == FAIL)
!       return e_invalid_argument;
  
!     return NULL;
  }
  #endif
  
  /*
!  * The 'display' option is changed.
   */
      char *
! did_set_display(optset_T *args UNUSED)
  {
!     if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK)
!       return e_invalid_argument;
! 
!     (void)init_chartab();
      return NULL;
  }
  
***************
*** 1092,1108 ****
  }
  
  /*
-  * The 'eventignore' option is changed.
-  */
-     char *
- did_set_eventignore(optset_T *args UNUSED)
- {
-     if (check_ei() == FAIL)
-       return e_invalid_argument;
-     return NULL;
- }
- 
- /*
   * One of the 'encoding', 'fileencoding', 'termencoding' or 'makeencoding'
   * options is changed.
   */
--- 1251,1256 ----
***************
*** 1189,1296 ****
      return errmsg;
  }
  
- #if defined(FEAT_POSTSCRIPT) || defined(PROTO)
- /*
-  * The 'printencoding' option is changed.
-  */
-     char *
- did_set_printencoding(optset_T *args UNUSED)
- {
-     char_u    *s, *p;
- 
-     // Canonize 'printencoding' if VIM standard one
-     p = enc_canonize(p_penc);
-     if (p != NULL)
-     {
-       vim_free(p_penc);
-       p_penc = p;
-     }
-     else
-     {
-       // Ensure lower case and '-' for '_'
-       for (s = p_penc; *s != NUL; s++)
-       {
-           if (*s == '_')
-               *s = '-';
-           else
-               *s = TOLOWER_ASC(*s);
-       }
-     }
- 
-     return NULL;
- }
- #endif
- 
- #if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(PROTO)
  /*
!  * The 'imactivatekey' option is changed.
   */
      char *
! did_set_imactivatekey(optset_T *args UNUSED)
  {
!     if (!im_xim_isvalid_imactivate())
        return e_invalid_argument;
      return NULL;
  }
- #endif
- 
- #if defined(FEAT_KEYMAP) || defined(PROTO)
- /*
-  * The 'keymap' option is changed.
-  */
-     char *
- did_set_keymap(optset_T *args)
- {
-     char *errmsg = NULL;
- 
-     if (!valid_filetype(args->os_varp))
-       errmsg = e_invalid_argument;
-     else
-     {
-       int         secure_save = secure;
- 
-       // Reset the secure flag, since the value of 'keymap' has
-       // been checked to be safe.
-       secure = 0;
- 
-       // load or unload key mapping tables
-       errmsg = keymap_init();
- 
-       secure = secure_save;
- 
-       // Since we check the value, there is no need to set P_INSECURE,
-       // even when the value comes from a modeline.
-       args->os_value_checked = TRUE;
-     }
- 
-     if (errmsg == NULL)
-     {
-       if (*curbuf->b_p_keymap != NUL)
-       {
-           // Installed a new keymap, switch on using it.
-           curbuf->b_p_iminsert = B_IMODE_LMAP;
-           if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
-               curbuf->b_p_imsearch = B_IMODE_LMAP;
-       }
-       else
-       {
-           // Cleared the keymap, may reset 'iminsert' and 'imsearch'.
-           if (curbuf->b_p_iminsert == B_IMODE_LMAP)
-               curbuf->b_p_iminsert = B_IMODE_NONE;
-           if (curbuf->b_p_imsearch == B_IMODE_LMAP)
-               curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
-       }
-       if ((args->os_flags & OPT_LOCAL) == 0)
-       {
-           set_iminsert_global();
-           set_imsearch_global();
-       }
-       status_redraw_curbuf();
-     }
- 
-     return errmsg;
- }
- #endif
  
  /*
   * The 'fileformat' option is changed.
--- 1337,1352 ----
      return errmsg;
  }
  
  /*
!  * The 'eventignore' option is changed.
   */
      char *
! did_set_eventignore(optset_T *args UNUSED)
  {
!     if (check_ei() == FAIL)
        return e_invalid_argument;
      return NULL;
  }
  
  /*
   * The 'fileformat' option is changed.
***************
*** 1337,1507 ****
      return NULL;
  }
  
- #if defined(FEAT_CRYPT) || defined(PROTO)
  /*
!  * The 'cryptkey' option is changed.
   */
      char *
! did_set_cryptkey(optset_T *args)
  {
!     // Make sure the ":set" command doesn't show the new value in the
!     // history.
!     remove_key_from_history();
  
!     if (STRCMP(curbuf->b_p_key, args->os_oldval.string) != 0)
!     {
!       // Need to update the swapfile.
!       ml_set_crypt_key(curbuf, args->os_oldval.string,
!               *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
!       changed_internal();
!     }
  
      return NULL;
  }
  
  /*
!  * The 'cryptmethod' option is changed.
   */
      char *
! did_set_cryptmethod(optset_T *args)
  {
!     char_u  *p;
!     char_u  *s;
! 
!     if (args->os_flags & OPT_LOCAL)
!       p = curbuf->b_p_cm;
!     else
!       p = p_cm;
!     if (check_opt_strings(p, p_cm_values, TRUE) != OK)
!       return e_invalid_argument;
!     else if (crypt_self_test() == FAIL)
!       return e_invalid_argument;
! 
!     // When setting the global value to empty, make it "zip".
!     if (*p_cm == NUL)
!     {
!       free_string_option(p_cm);
!       p_cm = vim_strsave((char_u *)"zip");
!     }
!     // When using ":set cm=name" the local value is going to be empty.
!     // Do that here, otherwise the crypt functions will still use the
!     // local value.
!     if ((args->os_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
!     {
!       free_string_option(curbuf->b_p_cm);
!       curbuf->b_p_cm = empty_option;
!     }
! 
!     // Need to update the swapfile when the effective method changed.
!     // Set "s" to the effective old value, "p" to the effective new
!     // method and compare.
!     if ((args->os_flags & OPT_LOCAL) && *args->os_oldval.string == NUL)
!       s = p_cm;  // was previously using the global value
!     else
!       s = args->os_oldval.string;
!     if (*curbuf->b_p_cm == NUL)
!       p = p_cm;  // is now using the global value
!     else
!       p = curbuf->b_p_cm;
!     if (STRCMP(s, p) != 0)
!       ml_set_crypt_key(curbuf, curbuf->b_p_key, s);
! 
!     // If the global value changes need to update the swapfile for all
!     // buffers using that value.
!     if ((args->os_flags & OPT_GLOBAL)
!           && STRCMP(p_cm, args->os_oldval.string) != 0)
!     {
!       buf_T   *buf;
  
!       FOR_ALL_BUFFERS(buf)
!           if (buf != curbuf && *buf->b_p_cm == NUL)
!               ml_set_crypt_key(buf, buf->b_p_key, args->os_oldval.string);
!     }
      return NULL;
  }
  #endif
  
  /*
!  * The 'matchpairs' option is changed.
   */
      char *
! did_set_matchpairs(optset_T *args)
  {
!     char_u    *p;
  
!     if (has_mbyte)
!     {
!       for (p = args->os_varp; *p != NUL; ++p)
!       {
!           int x2 = -1;
!           int x3 = -1;
  
!           p += mb_ptr2len(p);
!           if (*p != NUL)
!               x2 = *p++;
!           if (*p != NUL)
!           {
!               x3 = mb_ptr2char(p);
!               p += mb_ptr2len(p);
!           }
!           if (x2 != ':' || x3 == -1 || (*p != NUL && *p != ','))
!               return e_invalid_argument;
!           if (*p == NUL)
!               break;
!       }
!     }
!     else
!     {
!       // Check for "x:y,x:y"
!       for (p = args->os_varp; *p != NUL; p += 4)
!       {
!           if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ','))
!               return e_invalid_argument;
!           if (p[3] == NUL)
!               break;
!       }
!     }
  
      return NULL;
  }
  
  /*
!  * The 'comments' option is changed.
   */
      char *
! did_set_comments(optset_T *args)
  {
!     char_u    *s;
!     char      *errmsg = NULL;
  
!     for (s = args->os_varp; *s; )
!     {
!       while (*s && *s != ':')
!       {
!           if (vim_strchr((char_u *)COM_ALL, *s) == NULL
!                   && !VIM_ISDIGIT(*s) && *s != '-')
!           {
!               errmsg = illegal_char(args->os_errbuf, *s);
!               break;
!           }
!           ++s;
!       }
!       if (*s++ == NUL)
!           errmsg = e_missing_colon;
!       else if (*s == ',' || *s == NUL)
!           errmsg = e_zero_length_string;
!       if (errmsg != NULL)
!           break;
!       while (*s && *s != ',')
!       {
!           if (*s == '\\' && s[1] != NUL)
!               ++s;
!           ++s;
!       }
!       s = skip_to_option_part(s);
!     }
  
!     return errmsg;
  }
  
  /*
--- 1393,1507 ----
      return NULL;
  }
  
  /*
!  * The 'filetype' or the 'syntax' option is changed.
   */
      char *
! did_set_filetype_or_syntax(optset_T *args)
  {
!     if (!valid_filetype(args->os_varp))
!       return e_invalid_argument;
  
!     args->os_value_changed =
!                       STRCMP(args->os_oldval.string, args->os_varp) != 0;
! 
!     // Since we check the value, there is no need to set P_INSECURE,
!     // even when the value comes from a modeline.
!     args->os_value_checked = TRUE;
  
      return NULL;
  }
  
+ #if defined(FEAT_FOLDING) || defined(PROTO)
  /*
!  * The 'foldclose' option is changed.
   */
      char *
! did_set_foldclose(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_fcl, p_fcl_values, TRUE);
! }
! #endif
  
! #if (defined(FEAT_EVAL) && defined(FEAT_FOLDING)) || defined(PROTO)
! /*
!  * The 'foldexpr' option is changed.
!  */
!     char *
! did_set_foldexpr(optset_T *args)
! {
!     (void)did_set_optexpr(args);
!     if (foldmethodIsExpr(curwin))
!       foldUpdateAll(curwin);
      return NULL;
  }
  #endif
  
+ #if defined(FEAT_FOLDING) || defined(PROTO)
  /*
!  * The 'foldignore' option is changed.
   */
      char *
! did_set_foldignore(optset_T *args UNUSED)
  {
!     if (foldmethodIsIndent(curwin))
!       foldUpdateAll(curwin);
!     return NULL;
! }
  
! /*
!  * The 'foldmarker' option is changed.
!  */
!     char *
! did_set_foldmarker(optset_T *args)
! {
!     char_u    *p;
  
!     p = vim_strchr(args->os_varp, ',');
!     if (p == NULL)
!       return e_comma_required;
!     else if (p == args->os_varp || p[1] == NUL)
!       return e_invalid_argument;
!     else if (foldmethodIsMarker(curwin))
!       foldUpdateAll(curwin);
  
      return NULL;
  }
  
  /*
!  * The 'foldmethod' option is changed.
   */
      char *
! did_set_foldmethod(optset_T *args)
  {
!     if (check_opt_strings(args->os_varp, p_fdm_values, FALSE) != OK
!           || *curwin->w_p_fdm == NUL)
!       return e_invalid_argument;
  
!     foldUpdateAll(curwin);
!     if (foldmethodIsDiff(curwin))
!       newFoldLevel();
!     return NULL;
! }
  
! /*
!  * The 'foldopen' option is changed.
!  */
!     char *
! did_set_foldopen(optset_T *args UNUSED)
! {
!     return did_set_opt_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
! }
! #endif
! 
! /*
!  * The 'formatoptions' option is changed.
!  */
!     char *
! did_set_formatoptions(optset_T *args)
! {
!     return did_set_option_listflag(args->os_varp, (char_u *)FO_ALL,
!                                                       args->os_errbuf);
  }
  
  /*
***************
*** 1544,1713 ****
      return NULL;
  }
  
- /*
-  * The 'verbosefile' option is changed.
-  */
-     char *
- did_set_verbosefile(optset_T *args UNUSED)
- {
-     verbose_stop();
-     if (*p_vfile != NUL && verbose_open() == FAIL)
-       return e_invalid_argument;
- 
-     return NULL;
- }
- 
- #if defined(FEAT_VIMINFO) || defined(PROTO)
- /*
-  * The 'viminfo' option is changed.
-  */
-     char *
- did_set_viminfo(optset_T *args)
- {
-     char_u    *s;
-     char      *errmsg = NULL;
- 
-     for (s = p_viminfo; *s;)
-     {
-       // Check it's a valid character
-       if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL)
-       {
-           errmsg = illegal_char(args->os_errbuf, *s);
-           break;
-       }
-       if (*s == 'n')  // name is always last one
-           break;
-       else if (*s == 'r') // skip until next ','
-       {
-           while (*++s && *s != ',')
-               ;
-       }
-       else if (*s == '%')
-       {
-           // optional number
-           while (vim_isdigit(*++s))
-               ;
-       }
-       else if (*s == '!' || *s == 'h' || *s == 'c')
-           ++s;                // no extra chars
-       else            // must have a number
-       {
-           while (vim_isdigit(*++s))
-               ;
- 
-           if (!VIM_ISDIGIT(*(s - 1)))
-           {
-               if (args->os_errbuf != NULL)
-               {
-                   sprintf(args->os_errbuf,
-                           _(e_missing_number_after_angle_str_angle),
-                           transchar_byte(*(s - 1)));
-                   errmsg = args->os_errbuf;
-               }
-               else
-                   errmsg = "";
-               break;
-           }
-       }
-       if (*s == ',')
-           ++s;
-       else if (*s)
-       {
-           if (args->os_errbuf != NULL)
-               errmsg = e_missing_comma;
-           else
-               errmsg = "";
-           break;
-       }
-     }
-     if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0)
-       errmsg = e_must_specify_a_value;
- 
-     return errmsg;
- }
- #endif
- 
- /*
-  * Some terminal option (t_xxx) is changed
-  */
-     static void
- did_set_term_option(char_u **varp, int *did_swaptcap UNUSED)
- {
-     // ":set t_Co=0" and ":set t_Co=1" do ":set t_Co="
-     if (varp == &T_CCO)
-     {
-       int colors = atoi((char *)T_CCO);
- 
-       // Only reinitialize colors if t_Co value has really changed to
-       // avoid expensive reload of colorscheme if t_Co is set to the
-       // same value multiple times.
-       if (colors != t_colors)
-       {
-           t_colors = colors;
-           if (t_colors <= 1)
-           {
-               vim_free(T_CCO);
-               T_CCO = empty_option;
-           }
- #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
-           if (is_term_win32())
-           {
-               swap_tcap();
-               *did_swaptcap = TRUE;
-           }
- #endif
-           // We now have a different color setup, initialize it again.
-           init_highlight(TRUE, FALSE);
-       }
-     }
-     ttest(FALSE);
-     if (varp == &T_ME)
-     {
-       out_str(T_ME);
-       redraw_later(UPD_CLEAR);
- #if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
-       // Since t_me has been set, this probably means that the user
-       // wants to use this as default colors.  Need to reset default
-       // background/foreground colors.
- # ifdef VIMDLL
-       if (!gui.in_use && !gui.starting)
- # endif
-           mch_set_normal_colors();
- #endif
-     }
-     if (varp == &T_BE && termcap_active)
-     {
-       MAY_WANT_TO_LOG_THIS;
- 
-       if (*T_BE == NUL)
-           // When clearing t_BE we assume the user no longer wants
-           // bracketed paste, thus disable it by writing t_BD.
-           out_str(T_BD);
-       else
-           out_str(T_BE);
-     }
- }
- 
- #if defined(FEAT_LINEBREAK) || defined(PROTO)
- /*
-  * The 'showbreak' option is changed.
-  */
-     char *
- did_set_showbreak(optset_T *args)
- {
-     char_u    *s;
- 
-     for (s = args->os_varp; *s; )
-     {
-       if (ptr2cells(s) != 1)
-           return e_showbreak_contains_unprintable_or_wide_character;
-       MB_PTR_ADV(s);
-     }
- 
-     return NULL;
- }
- #endif
- 
  #if defined(CURSOR_SHAPE) || defined(PROTO)
  /*
   * The 'guicursor' option is changed.
--- 1544,1549 ----
***************
*** 1809,1832 ****
  }
  #endif
  
! #if defined(FEAT_MOUSESHAPE) || defined(PROTO)
      char *
! did_set_mouseshape(optset_T *args UNUSED)
  {
      char *errmsg = NULL;
  
!     errmsg = parse_shape_opt(SHAPE_MOUSE);
!     update_mouseshape(-1);
  
      return errmsg;
  }
  #endif
  
  /*
   * The 'titlestring' or the 'iconstring' option is changed.
   */
      static char *
! did_set_titleiconstring(optset_T *args UNUSED, int flagval UNUSED)
  {
  #ifdef FEAT_STL_OPT
      // NULL => statusline syntax
--- 1645,1737 ----
  }
  #endif
  
! #if defined(FEAT_GUI) || defined(PROTO)
! /*
!  * The 'guioptions' option is changed.
!  */
      char *
! did_set_guioptions(optset_T *args)
! {
!     char *errmsg;
! 
!     errmsg = did_set_option_listflag(args->os_varp, (char_u *)GO_ALL,
!                                                       args->os_errbuf);
!     if (errmsg != NULL)
!       return errmsg;
! 
!     gui_init_which_components(args->os_oldval.string);
!     return NULL;
! }
! #endif
! 
! #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
! /*
!  * The 'guitablabel' option is changed.
!  */
!     char *
! did_set_guitablabel(optset_T *args UNUSED)
! {
!     redraw_tabline = TRUE;
!     return NULL;
! }
! #endif
! 
! /*
!  * The 'helpfile' option is changed.
!  */
!     char *
! did_set_helpfile(optset_T *args UNUSED)
! {
!     // May compute new values for $VIM and $VIMRUNTIME
!     if (didset_vim)
!       vim_unsetenv_ext((char_u *)"VIM");
!     if (didset_vimruntime)
!       vim_unsetenv_ext((char_u *)"VIMRUNTIME");
!     return NULL;
! }
! 
! #if defined(FEAT_MULTI_LANG) || defined(PROTO)
! /*
!  * The 'helplang' option is changed.
!  */
!     char *
! did_set_helplang(optset_T *args UNUSED)
  {
      char *errmsg = NULL;
  
!     // Check for "", "ab", "ab,cd", etc.
!     for (char_u *s = p_hlg; *s != NUL; s += 3)
!     {
!       if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL))
!       {
!           errmsg = e_invalid_argument;
!           break;
!       }
!       if (s[2] == NUL)
!           break;
!     }
  
      return errmsg;
  }
  #endif
  
  /*
+  * The 'highlight' option is changed.
+  */
+     char *
+ did_set_highlight(optset_T *args UNUSED)
+ {
+     if (highlight_changed() == FAIL)
+       return e_invalid_argument;      // invalid flags
+ 
+     return NULL;
+ }
+ 
+ /*
   * The 'titlestring' or the 'iconstring' option is changed.
   */
      static char *
! parse_titleiconstring(optset_T *args UNUSED, int flagval UNUSED)
  {
  #ifdef FEAT_STL_OPT
      // NULL => statusline syntax
***************
*** 1842,1861 ****
  }
  
  /*
-  * The 'titlestring' option is changed.
-  */
-     char *
- did_set_titlestring(optset_T *args)
- {
-     int flagval = 0;
- 
- #ifdef FEAT_STL_OPT
-     flagval = STL_IN_TITLE;
- #endif
-     return did_set_titleiconstring(args, flagval);
- }
- 
- /*
   * The 'iconstring' option is changed.
   */
      char *
--- 1747,1752 ----
***************
*** 1867,2142 ****
      flagval = STL_IN_ICON;
  #endif
  
!     return did_set_titleiconstring(args, flagval);
  }
  
  /*
!  * An option which is a list of flags is set.  Valid values are in 'flags'.
!  */
!     static char *
! did_set_option_listflag(char_u *varp, char_u *flags, char *errbuf)
! {
!     char_u    *s;
! 
!     for (s = varp; *s; ++s)
!       if (vim_strchr(flags, *s) == NULL)
!           return illegal_char(errbuf, *s);
! 
!     return NULL;
! }
! 
! #if defined(FEAT_GUI) || defined(PROTO)
! /*
!  * The 'guioptions' option is changed.
   */
      char *
! did_set_guioptions(optset_T *args)
  {
!     char *errmsg;
! 
!     errmsg = did_set_option_listflag(args->os_varp, (char_u *)GO_ALL,
!                                                       args->os_errbuf);
!     if (errmsg != NULL)
!       return errmsg;
! 
!     gui_init_which_components(args->os_oldval.string);
      return NULL;
  }
  #endif
  
- #if defined(FEAT_GUI_TABLINE)
  /*
!  * The 'guitablabel' option is changed.
   */
      char *
! did_set_guitablabel(optset_T *args UNUSED)
  {
!     redraw_tabline = TRUE;
      return NULL;
  }
- #endif
  
! #if defined(UNIX) || defined(VMS) || defined(PROTO)
  /*
!  * The 'ttymouse' option is changed.
   */
      char *
! did_set_ttymouse(optset_T *args UNUSED)
  {
      char *errmsg = NULL;
  
!     // Switch the mouse off before changing the escape sequences used for
!     // that.
!     mch_setmouse(FALSE);
!     if (opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE) != OK)
        errmsg = e_invalid_argument;
      else
!       check_mouse_termcode();
!     if (termcap_active)
!       setmouse();             // may switch it on again
  
      return errmsg;
  }
  #endif
  
  /*
!  * The 'selection' option is changed.
   */
      char *
! did_set_selection(optset_T *args UNUSED)
  {
!     if (*p_sel == NUL
!           || check_opt_strings(p_sel, p_sel_values, FALSE) != OK)
        return e_invalid_argument;
  
      return NULL;
  }
  
- #if defined(FEAT_BROWSE) || defined(PROTO)
  /*
!  * The 'browsedir' option is changed.
   */
      char *
! did_set_browsedir(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK
!           && !mch_isdir(p_bsdir))
        return e_invalid_argument;
  
      return NULL;
  }
- #endif
  
  /*
!  * The 'keymodel' option is changed.
   */
      char *
! did_set_keymodel(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_km, p_km_values, TRUE) != OK)
        return e_invalid_argument;
  
-     km_stopsel = (vim_strchr(p_km, 'o') != NULL);
-     km_startsel = (vim_strchr(p_km, 'a') != NULL);
      return NULL;
  }
  
  /*
!  * The 'keyprotocol' option is changed.
   */
      char *
! did_set_keyprotocol(optset_T *args UNUSED)
  {
!     if (match_keyprotocol(NULL) == KEYPROTOCOL_FAIL)
!       return e_invalid_argument;
  
      return NULL;
  }
  
  /*
!  * The 'mousemodel' option is changed.
   */
      char *
! did_set_mousemodel(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK)
        return e_invalid_argument;
- #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
-     else if (*p_mousem != *oldval)
-       // Changed from "extend" to "popup" or "popup_setpos" or vv: need
-       // to create or delete the popup menus.
-       gui_motif_update_mousemodel(root_menu);
- #endif
  
      return NULL;
  }
  
  /*
!  * The 'debug' option is changed.
   */
      char *
! did_set_debug(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_debug, p_debug_values, TRUE);
  }
  
  /*
!  * The 'display' option is changed.
   */
      char *
! did_set_display(optset_T *args UNUSED)
  {
!     if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK)
        return e_invalid_argument;
  
-     (void)init_chartab();
      return NULL;
  }
  
! #if defined(FEAT_SPELL) || defined(PROTO)
! /*
!  * The 'spellfile' option is changed.
!  */
      char *
! did_set_spellfile(optset_T *args)
  {
!     if (!valid_spellfile(args->os_varp))
!       return e_invalid_argument;
  
!     // If there is a window for this buffer in which 'spell' is set load the
!     // wordlists.
!     return did_set_spell_option(TRUE);
  }
  
  /*
!  * The 'spell' option is changed.
   */
      char *
! did_set_spelllang(optset_T *args)
  {
!     if (!valid_spelllang(args->os_varp))
!       return e_invalid_argument;
! 
!     // If there is a window for this buffer in which 'spell' is set load the
!     // wordlists.
!     return did_set_spell_option(FALSE);
  }
  
  /*
!  * The 'spellcapcheck' option is changed.
   */
!     char *
! did_set_spellcapcheck(optset_T *args UNUSED)
  {
!     // compile the regexp program.
!     return compile_cap_prog(curwin->w_s);
  }
  
  /*
!  * The 'spelloptions' option is changed.
   */
      char *
! did_set_spelloptions(optset_T *args)
  {
!     if (*args->os_varp != NUL && STRCMP("camel", args->os_varp) != 0)
!       return e_invalid_argument;
  
      return NULL;
  }
  
  /*
!  * The 'spellsuggest' option is changed.
   */
      char *
! did_set_spellsuggest(optset_T *args UNUSED)
  {
!     if (spell_check_sps() != OK)
!       return e_invalid_argument;
  
      return NULL;
  }
  
  /*
!  * The 'mkspellmem' option is changed.
   */
      char *
! did_set_mkspellmem(optset_T *args UNUSED)
  {
!     if (spell_check_msm() != OK)
        return e_invalid_argument;
  
      return NULL;
  }
  #endif
  
  /*
!  * The 'nrformats' option is changed.
!  */
!     char *
! did_set_nrformats(optset_T *args)
! {
!     return did_set_opt_strings(args->os_varp, p_nf_values, TRUE);
! }
! 
! /*
!  * The 'buftype' option is changed.
   */
      char *
! did_set_buftype(optset_T *args UNUSED)
  {
!     if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK)
!       return e_invalid_argument;
  
!     if (curwin->w_status_height)
      {
!       curwin->w_redr_status = TRUE;
!       redraw_later(UPD_VALID);
      }
-     curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
-     redraw_titles();
  
      return NULL;
  }
  
  #if defined(FEAT_STL_OPT) || defined(PROTO)
  /*
--- 1758,2129 ----
      flagval = STL_IN_ICON;
  #endif
  
!     return parse_titleiconstring(args, flagval);
  }
  
+ #if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(PROTO)
  /*
!  * The 'imactivatekey' option is changed.
   */
      char *
! did_set_imactivatekey(optset_T *args UNUSED)
  {
!     if (!im_xim_isvalid_imactivate())
!       return e_invalid_argument;
      return NULL;
  }
  #endif
  
  /*
!  * The 'isident' or the 'iskeyword' or the 'isprint' or the 'isfname' option 
is
!  * changed.
   */
      char *
! did_set_isopt(optset_T *args)
  {
!     // 'isident', 'iskeyword', 'isprint or 'isfname' option: refill 
g_chartab[]
!     // If the new option is invalid, use old value.
!     // 'lisp' option: refill g_chartab[] for '-' char.
!     if (init_chartab() == FAIL)
!     {
!       args->os_restore_chartab = TRUE;// need to restore the chartab.
!       return e_invalid_argument;      // error in value
!     }
! 
      return NULL;
  }
  
! #if defined(FEAT_KEYMAP) || defined(PROTO)
  /*
!  * The 'keymap' option is changed.
   */
      char *
! did_set_keymap(optset_T *args)
  {
      char *errmsg = NULL;
  
!     if (!valid_filetype(args->os_varp))
        errmsg = e_invalid_argument;
      else
!     {
!       int         secure_save = secure;
! 
!       // Reset the secure flag, since the value of 'keymap' has
!       // been checked to be safe.
!       secure = 0;
! 
!       // load or unload key mapping tables
!       errmsg = keymap_init();
! 
!       secure = secure_save;
! 
!       // Since we check the value, there is no need to set P_INSECURE,
!       // even when the value comes from a modeline.
!       args->os_value_checked = TRUE;
!     }
! 
!     if (errmsg == NULL)
!     {
!       if (*curbuf->b_p_keymap != NUL)
!       {
!           // Installed a new keymap, switch on using it.
!           curbuf->b_p_iminsert = B_IMODE_LMAP;
!           if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
!               curbuf->b_p_imsearch = B_IMODE_LMAP;
!       }
!       else
!       {
!           // Cleared the keymap, may reset 'iminsert' and 'imsearch'.
!           if (curbuf->b_p_iminsert == B_IMODE_LMAP)
!               curbuf->b_p_iminsert = B_IMODE_NONE;
!           if (curbuf->b_p_imsearch == B_IMODE_LMAP)
!               curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
!       }
!       if ((args->os_flags & OPT_LOCAL) == 0)
!       {
!           set_iminsert_global();
!           set_imsearch_global();
!       }
!       status_redraw_curbuf();
!     }
  
      return errmsg;
  }
  #endif
  
  /*
!  * The 'keymodel' option is changed.
   */
      char *
! did_set_keymodel(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_km, p_km_values, TRUE) != OK)
        return e_invalid_argument;
  
+     km_stopsel = (vim_strchr(p_km, 'o') != NULL);
+     km_startsel = (vim_strchr(p_km, 'a') != NULL);
      return NULL;
  }
  
  /*
!  * The 'keyprotocol' option is changed.
   */
      char *
! did_set_keyprotocol(optset_T *args UNUSED)
  {
!     if (match_keyprotocol(NULL) == KEYPROTOCOL_FAIL)
        return e_invalid_argument;
  
      return NULL;
  }
  
  /*
!  * The 'lispoptions' option is changed.
   */
      char *
! did_set_lispoptions(optset_T *args)
  {
!     if (*args->os_varp != NUL
!           && STRCMP(args->os_varp, "expr:0") != 0
!           && STRCMP(args->os_varp, "expr:1") != 0)
        return e_invalid_argument;
  
      return NULL;
  }
  
  /*
!  * The 'matchpairs' option is changed.
   */
      char *
! did_set_matchpairs(optset_T *args)
  {
!     char_u    *p;
! 
!     if (has_mbyte)
!     {
!       for (p = args->os_varp; *p != NUL; ++p)
!       {
!           int x2 = -1;
!           int x3 = -1;
! 
!           p += mb_ptr2len(p);
!           if (*p != NUL)
!               x2 = *p++;
!           if (*p != NUL)
!           {
!               x3 = mb_ptr2char(p);
!               p += mb_ptr2len(p);
!           }
!           if (x2 != ':' || x3 == -1 || (*p != NUL && *p != ','))
!               return e_invalid_argument;
!           if (*p == NUL)
!               break;
!       }
!     }
!     else
!     {
!       // Check for "x:y,x:y"
!       for (p = args->os_varp; *p != NUL; p += 4)
!       {
!           if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ','))
!               return e_invalid_argument;
!           if (p[3] == NUL)
!               break;
!       }
!     }
  
      return NULL;
  }
  
+ #if defined(FEAT_SPELL) || defined(PROTO)
  /*
!  * The 'mkspellmem' option is changed.
   */
      char *
! did_set_mkspellmem(optset_T *args UNUSED)
  {
!     if (spell_check_msm() != OK)
        return e_invalid_argument;
  
      return NULL;
  }
+ #endif
  
  /*
!  * The 'mouse' option is changed.
   */
      char *
! did_set_mouse(optset_T *args)
  {
!     return did_set_option_listflag(args->os_varp, (char_u *)MOUSE_ALL,
!                                                       args->os_errbuf);
  }
  
  /*
!  * The 'mousemodel' option is changed.
   */
      char *
! did_set_mousemodel(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK)
        return e_invalid_argument;
+ #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
+     else if (*p_mousem != *oldval)
+       // Changed from "extend" to "popup" or "popup_setpos" or vv: need
+       // to create or delete the popup menus.
+       gui_motif_update_mousemodel(root_menu);
+ #endif
  
      return NULL;
  }
  
! #if defined(FEAT_MOUSESHAPE) || defined(PROTO)
      char *
! did_set_mouseshape(optset_T *args UNUSED)
  {
!     char *errmsg = NULL;
  
!     errmsg = parse_shape_opt(SHAPE_MOUSE);
!     update_mouseshape(-1);
! 
!     return errmsg;
  }
+ #endif
  
  /*
!  * The 'nrformats' option is changed.
   */
      char *
! did_set_nrformats(optset_T *args)
  {
!     return did_set_opt_strings(args->os_varp, p_nf_values, TRUE);
  }
  
+ #if defined(FEAT_EVAL) || defined(PROTO)
  /*
!  * Returns TRUE if the option pointed by "varp" or "gvarp" is one of the
!  * '*expr' options: 'balloonexpr', 'diffexpr', 'foldexpr', 'foldtext',
!  * 'formatexpr', 'includeexpr', 'indentexpr', 'patchexpr', 'printexpr' or
!  * 'charconvert'.
   */
!     static int
! is_expr_option(char_u **varp, char_u **gvarp)
  {
!     return (
! # ifdef FEAT_BEVAL
!       varp == &p_bexpr ||                     // 'balloonexpr'
! # endif
! # ifdef FEAT_DIFF
!       varp == &p_dex ||                       // 'diffexpr'
! # endif
! # ifdef FEAT_FOLDING
!       gvarp == &curwin->w_allbuf_opt.wo_fde ||        // 'foldexpr'
!       gvarp == &curwin->w_allbuf_opt.wo_fdt ||        // 'foldtext'
! # endif
!       gvarp == &p_fex ||                      // 'formatexpr'
! # ifdef FEAT_FIND_ID
!       gvarp == &p_inex ||                     // 'includeexpr'
! # endif
!       gvarp == &p_inde ||                     // 'indentexpr'
! # ifdef FEAT_DIFF
!       varp == &p_pex ||                       // 'patchexpr'
! # endif
! # ifdef FEAT_POSTSCRIPT
!       varp == &p_pexpr ||                     // 'printexpr'
! # endif
!       varp == &p_ccv);                        // 'charconvert'
  }
  
  /*
!  * One of the '*expr' options is changed: 'balloonexpr', 'diffexpr',
!  * 'foldexpr', 'foldtext', 'formatexpr', 'includeexpr', 'indentexpr',
!  * 'patchexpr', 'printexpr' and 'charconvert'.
!  *
   */
      char *
! did_set_optexpr(optset_T *args)
  {
!     // If the option value starts with <SID> or s:, then replace that with
!     // the script identifier.
!     char_u *name = get_scriptlocal_funcname(args->os_varp);
!     if (name != NULL)
!     {
!       free_string_option(args->os_varp);
!       args->os_varp = name;
!     }
  
      return NULL;
  }
+ #endif
  
  /*
!  * The 'pastetoggle' option is changed.
   */
      char *
! did_set_pastetoggle(optset_T *args UNUSED)
  {
!     char_u    *p;
! 
!     // translate key codes like in a mapping
!     if (*p_pt)
!     {
!       (void)replace_termcodes(p_pt, &p,
!               REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
!       if (p != NULL)
!       {
!           free_string_option(p_pt);
!           p_pt = p;
!       }
!     }
  
      return NULL;
  }
  
+ #if defined(FEAT_PROP_POPUP) || defined(PROTO)
  /*
!  * The 'previewpopup' option is changed.
   */
      char *
! did_set_previewpopup(optset_T *args UNUSED)
  {
!     if (parse_previewpopup(NULL) == FAIL)
        return e_invalid_argument;
  
      return NULL;
  }
  #endif
  
+ #if defined(FEAT_POSTSCRIPT) || defined(PROTO)
  /*
!  * The 'printencoding' option is changed.
   */
      char *
! did_set_printencoding(optset_T *args UNUSED)
  {
!     char_u    *s, *p;
  
!     // Canonize 'printencoding' if VIM standard one
!     p = enc_canonize(p_penc);
!     if (p != NULL)
      {
!       vim_free(p_penc);
!       p_penc = p;
!     }
!     else
!     {
!       // Ensure lower case and '-' for '_'
!       for (s = p_penc; *s != NUL; s++)
!       {
!           if (*s == '_')
!               *s = '-';
!           else
!               *s = TOLOWER_ASC(*s);
!       }
      }
  
      return NULL;
  }
+ #endif
  
  #if defined(FEAT_STL_OPT) || defined(PROTO)
  /*
***************
*** 2144,2150 ****
   * "rulerformat" is TRUE if the 'rulerformat' option is changed.
   */
      static char *
! did_set_statustabline_rulerformat(optset_T *args, int rulerformat)
  {
      char_u    *s;
      char      *errmsg = NULL;
--- 2131,2137 ----
   * "rulerformat" is TRUE if the 'rulerformat' option is changed.
   */
      static char *
! parse_statustabline_rulerformat(optset_T *args, int rulerformat)
  {
      char_u    *s;
      char      *errmsg = NULL;
***************
*** 2172,2688 ****
  
      return errmsg;
  }
  
  /*
!  * The 'statusline' option is changed.
   */
      char *
! did_set_statusline(optset_T *args)
  {
!     return did_set_statustabline_rulerformat(args, FALSE);
  }
  
  /*
!  * The 'tabline' option is changed.
   */
      char *
! did_set_tabline(optset_T *args)
  {
!     return did_set_statustabline_rulerformat(args, FALSE);
! }
  
  
  /*
   * The 'rulerformat' option is changed.
   */
      char *
  did_set_rulerformat(optset_T *args)
  {
!     return did_set_statustabline_rulerformat(args, TRUE);
  }
  #endif
  
  /*
!  * The 'complete' option is changed.
   */
      char *
! did_set_complete(optset_T *args)
  {
!     char_u    *s;
! 
!     // check if it is a valid value for 'complete' -- Acevedo
!     for (s = args->os_varp; *s;)
!     {
!       while (*s == ',' || *s == ' ')
!           s++;
!       if (!*s)
!           break;
!       if (vim_strchr((char_u *)".wbuksid]tU", *s) == NULL)
!           return illegal_char(args->os_errbuf, *s);
!       if (*++s != NUL && *s != ',' && *s != ' ')
!       {
!           if (s[-1] == 'k' || s[-1] == 's')
!           {
!               // skip optional filename after 'k' and 's'
!               while (*s && *s != ',' && *s != ' ')
!               {
!                   if (*s == '\\' && s[1] != NUL)
!                       ++s;
!                   ++s;
!               }
!           }
!           else
!           {
!               if (args->os_errbuf != NULL)
!               {
!                   sprintf((char *)args->os_errbuf,
!                           _(e_illegal_character_after_chr), *--s);
!                   return args->os_errbuf;
!               }
!               return "";
!           }
!       }
!     }
! 
!     return NULL;
  }
  
  /*
!  * The 'completeopt' option is changed.
   */
      char *
! did_set_completeopt(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK)
        return e_invalid_argument;
  
-     completeopt_was_set();
      return NULL;
  }
  
- #if defined(BACKSLASH_IN_FILENAME) || defined(PROTO)
  /*
!  * The 'completeslash' option is changed.
   */
      char *
! did_set_completeslash(optset_T *args UNUSED)
  {
!     if (check_opt_strings(p_csl, p_csl_values, FALSE) != OK
!           || check_opt_strings(curbuf->b_p_csl, p_csl_values, FALSE) != OK)
!       return e_invalid_argument;
! 
!     return NULL;
  }
- #endif
  
! #if defined(FEAT_SIGNS) || defined(PROTO)
  /*
!  * The 'signcolumn' option is changed.
   */
      char *
! did_set_signcolumn(optset_T *args)
  {
!     if (check_opt_strings(args->os_varp, p_scl_values, FALSE) != OK)
        return e_invalid_argument;
!     // When changing the 'signcolumn' to or from 'number', recompute the
!     // width of the number column if 'number' or 'relativenumber' is set.
!     if (((*args->os_oldval.string == 'n' && args->os_oldval.string[1] == 'u')
!               || (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) =='u'))
!           && (curwin->w_p_nu || curwin->w_p_rnu))
!       curwin->w_nrwidth_line_count = 0;
  
      return NULL;
  }
  #endif
  
- #if (defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)) || defined(PROTO)
  /*
!  * The 'toolbar' option is changed.
   */
      char *
! did_set_toolbar(optset_T *args UNUSED)
  {
!     if (opt_strings_flags(p_toolbar, p_toolbar_values,
!               &toolbar_flags, TRUE) != OK)
!       return e_invalid_argument;
! 
!     out_flush();
!     gui_mch_show_toolbar((toolbar_flags &
!               (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
!     return NULL;
  }
- #endif
  
! #if (defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)) || defined(PROTO)
  /*
!  * The 'toolbariconsize' option is changed.  GTK+ 2 only.
   */
      char *
! did_set_toolbariconsize(optset_T *args UNUSED)
  {
!     if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK)
!       return e_invalid_argument;
  
-     out_flush();
-     gui_mch_show_toolbar((toolbar_flags &
-               (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
      return NULL;
  }
  #endif
  
  /*
!  * The 'pastetoggle' option is changed.
   */
      char *
! did_set_pastetoggle(optset_T *args UNUSED)
  {
!     char_u    *p;
! 
!     // translate key codes like in a mapping
!     if (*p_pt)
!     {
!       (void)replace_termcodes(p_pt, &p,
!               REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
!       if (p != NULL)
!       {
!           free_string_option(p_pt);
!           p_pt = p;
!       }
!     }
! 
!     return NULL;
  }
  
  /*
!  * The 'backspace' option is changed.
   */
      char *
! did_set_backspace(optset_T *args UNUSED)
  {
!     if (VIM_ISDIGIT(*p_bs))
!     {
!       if (*p_bs > '3' || p_bs[1] != NUL)
!           return e_invalid_argument;
!     }
!     else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
        return e_invalid_argument;
  
      return NULL;
  }
  
  /*
!  * The 'bufhidden' option is changed.
   */
      char *
! did_set_bufhidden(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(curbuf->b_p_bh, p_bufhidden_values, FALSE);
  }
  
  /*
!  * The 'tagcase' option is changed.
   */
      char *
! did_set_tagcase(optset_T *args)
  {
!     unsigned int      *flags;
!     char_u            *p;
! 
!     if (args->os_flags & OPT_LOCAL)
!     {
!       p = curbuf->b_p_tc;
!       flags = &curbuf->b_tc_flags;
!     }
!     else
!     {
!       p = p_tc;
!       flags = &tc_flags;
!     }
! 
!     if ((args->os_flags & OPT_LOCAL) && *p == NUL)
!       // make the local value empty: use the global value
!       *flags = 0;
!     else if (*p == NUL
!           || opt_strings_flags(p, p_tc_values, flags, FALSE) != OK)
        return e_invalid_argument;
  
!     return NULL;
  }
  
- #if defined(FEAT_DIFF) || defined(PROTO)
  /*
!  * The 'diffopt' option is changed.
   */
      char *
! did_set_diffopt(optset_T *args UNUSED)
  {
!     if (diffopt_changed() == FAIL)
        return e_invalid_argument;
  
!     return NULL;
  }
- #endif
  
- #if defined(FEAT_FOLDING) || defined(PROTO)
  /*
!  * The 'foldmethod' option is changed.
   */
      char *
! did_set_foldmethod(optset_T *args)
  {
!     if (check_opt_strings(args->os_varp, p_fdm_values, FALSE) != OK
!           || *curwin->w_p_fdm == NUL)
        return e_invalid_argument;
  
-     foldUpdateAll(curwin);
-     if (foldmethodIsDiff(curwin))
-       newFoldLevel();
      return NULL;
  }
  
  /*
!  * The 'foldmarker' option is changed.
   */
      char *
! did_set_foldmarker(optset_T *args)
  {
!     char_u    *p;
! 
!     p = vim_strchr(args->os_varp, ',');
!     if (p == NULL)
!       return e_comma_required;
!     else if (p == args->os_varp || p[1] == NUL)
        return e_invalid_argument;
-     else if (foldmethodIsMarker(curwin))
-       foldUpdateAll(curwin);
  
      return NULL;
  }
  
  /*
!  * The 'commentstring' option is changed.
   */
      char *
! did_set_commentstring(optset_T *args)
  {
!     if (*args->os_varp != NUL && strstr((char *)args->os_varp, "%s") == NULL)
!       return e_commentstring_must_be_empty_or_contain_str;
  
!     return NULL;
  }
  
  /*
!  * The 'foldignore' option is changed.
   */
      char *
! did_set_foldignore(optset_T *args UNUSED)
  {
!     if (foldmethodIsIndent(curwin))
!       foldUpdateAll(curwin);
!     return NULL;
  }
  
  /*
!  * The 'foldclose' option is changed.
   */
      char *
! did_set_foldclose(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_fcl, p_fcl_values, TRUE);
  }
  
  /*
!  * The 'foldopen' option is changed.
   */
      char *
! did_set_foldopen(optset_T *args UNUSED)
  {
!     return did_set_opt_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
  }
  #endif
  
  /*
!  * The 'virtualedit' option is changed.
   */
      char *
! did_set_virtualedit(optset_T *args)
  {
!     char_u            *ve = p_ve;
!     unsigned int      *flags = &ve_flags;
  
      if (args->os_flags & OPT_LOCAL)
      {
!       ve = curwin->w_p_ve;
!       flags = &curwin->w_ve_flags;
      }
- 
-     if ((args->os_flags & OPT_LOCAL) && *ve == NUL)
-       // make the local value empty: use the global value
-       *flags = 0;
      else
      {
!       if (opt_strings_flags(ve, p_ve_values, flags, TRUE) != OK)
!           return e_invalid_argument;
!       else if (STRCMP(ve, args->os_oldval.string) != 0)
!       {
!           // Recompute cursor position in case the new 've' setting
!           // changes something.
!           validate_virtcol();
!           coladvance(curwin->w_virtcol);
!       }
      }
  
      return NULL;
  }
  
- #if (defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)) || defined(PROTO)
  /*
!  * The 'cscopequickfix' option is changed.
   */
!     char *
! did_set_cscopequickfix(optset_T *args UNUSED)
  {
!     char_u    *p;
! 
!     if (p_csqf == NULL)
!       return NULL;
  
!     p = p_csqf;
!     while (*p != NUL)
      {
!       if (vim_strchr((char_u *)CSQF_CMDS, *p) == NULL
!               || p[1] == NUL
!               || vim_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL
!               || (p[2] != NUL && p[2] != ','))
!           return e_invalid_argument;
!       else if (p[2] == NUL)
!           break;
!       else
!           p += 3;
      }
  
!     return NULL;
  }
- #endif
  
  /*
!  * The 'cinoptions' option is changed.
   */
!     char *
! did_set_cinoptions(optset_T *args UNUSED)
  {
!     // TODO: recognize errors
!     parse_cino(curbuf);
  
!     return NULL;
  }
  
  /*
!  * The 'lispoptions' option is changed.
   */
      char *
! did_set_lispoptions(optset_T *args)
  {
!     if (*args->os_varp != NUL
!           && STRCMP(args->os_varp, "expr:0") != 0
!           && STRCMP(args->os_varp, "expr:1") != 0)
        return e_invalid_argument;
  
      return NULL;
  }
  
- #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO)
  /*
!  * The 'renderoptions' option is changed.
   */
      char *
! did_set_renderoptions(optset_T *args UNUSED)
  {
!     if (!gui_mch_set_rendering_options(p_rop))
        return e_invalid_argument;
  
      return NULL;
  }
- #endif
  
! #if defined(FEAT_RIGHTLEFT) || defined(PROTO)
  /*
!  * The 'rightleftcmd' option is changed.
   */
      char *
! did_set_rightleftcmd(optset_T *args)
  {
!     // Currently only "search" is a supported value.
!     if (*args->os_varp != NUL && STRCMP(args->os_varp, "search") != 0)
!       return e_invalid_argument;
! 
!     return NULL;
  }
  #endif
  
  /*
!  * The 'filetype' or the 'syntax' option is changed.
   */
      char *
! did_set_filetype_or_syntax(optset_T *args)
  {
!     if (!valid_filetype(args->os_varp))
!       return e_invalid_argument;
! 
!     args->os_value_changed =
!                       STRCMP(args->os_oldval.string, args->os_varp) != 0;
! 
!     // Since we check the value, there is no need to set P_INSECURE,
!     // even when the value comes from a modeline.
!     args->os_value_checked = TRUE;
  
!     return NULL;
  }
  
! #if defined(FEAT_TERMINAL) || defined(PROTO)
  /*
!  * The 'termwinkey' option is changed.
   */
      char *
! did_set_termwinkey(optset_T *args UNUSED)
  {
!     if (*curwin->w_p_twk != NUL
!           && string_to_key(curwin->w_p_twk, TRUE) == 0)
        return e_invalid_argument;
  
      return NULL;
  }
  
  /*
!  * The 'termwinsize' option is changed.
   */
      char *
! did_set_termwinsize(optset_T *args UNUSED)
  {
!     char_u    *p;
! 
!     if (*curwin->w_p_tws == NUL)
!       return NULL;
! 
!     p = skipdigits(curwin->w_p_tws);
!     if (p == curwin->w_p_tws
!           || (*p != 'x' && *p != '*')
!           || *skipdigits(p + 1) != NUL)
        return e_invalid_argument;
  
      return NULL;
  }
  
! # if defined(MSWIN) || defined(PROTO)
  /*
!  * The 'termwintype' option is changed.
   */
      char *
! did_set_termwintype(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_twt, p_twt_values, FALSE);
  }
- # endif
  #endif
  
  #if defined(FEAT_VARTABS) || defined(PROTO)
--- 2159,2670 ----
  
      return errmsg;
  }
+ #endif
  
+ #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO)
  /*
!  * The 'renderoptions' option is changed.
   */
      char *
! did_set_renderoptions(optset_T *args UNUSED)
  {
!     if (!gui_mch_set_rendering_options(p_rop))
!       return e_invalid_argument;
! 
!     return NULL;
  }
+ #endif
  
+ #if defined(FEAT_RIGHTLEFT) || defined(PROTO)
  /*
!  * The 'rightleftcmd' option is changed.
   */
      char *
! did_set_rightleftcmd(optset_T *args)
  {
!     // Currently only "search" is a supported value.
!     if (*args->os_varp != NUL && STRCMP(args->os_varp, "search") != 0)
!       return e_invalid_argument;
  
+     return NULL;
+ }
+ #endif
  
+ #if defined(FEAT_STL_OPT) || defined(PROTO)
  /*
   * The 'rulerformat' option is changed.
   */
      char *
  did_set_rulerformat(optset_T *args)
  {
!     return parse_statustabline_rulerformat(args, TRUE);
  }
  #endif
  
  /*
!  * The 'scrollopt' option is changed.
   */
      char *
! did_set_scrollopt(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_sbo, p_scbopt_values, TRUE);
  }
  
  /*
!  * The 'selection' option is changed.
   */
      char *
! did_set_selection(optset_T *args UNUSED)
  {
!     if (*p_sel == NUL
!           || check_opt_strings(p_sel, p_sel_values, FALSE) != OK)
        return e_invalid_argument;
  
      return NULL;
  }
  
  /*
!  * The 'selectmode' option is changed.
   */
      char *
! did_set_selectmode(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_slm, p_slm_values, TRUE);
  }
  
! #if defined(FEAT_SESSION) || defined(PROTO)
  /*
!  * The 'sessionoptions' option is changed.
   */
      char *
! did_set_sessionoptions(optset_T *args)
  {
!     if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK)
        return e_invalid_argument;
!     if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR))
!     {
!       // Don't allow both "sesdir" and "curdir".
!       (void)opt_strings_flags(args->os_oldval.string, p_ssop_values,
!                                                       &ssop_flags, TRUE);
!       return e_invalid_argument;
!     }
  
      return NULL;
  }
  #endif
  
  /*
!  * The 'shortmess' option is changed.
   */
      char *
! did_set_shortmess(optset_T *args)
  {
!     return did_set_option_listflag(args->os_varp, (char_u *)SHM_ALL,
!                                                       args->os_errbuf);
  }
  
! #if defined(FEAT_LINEBREAK) || defined(PROTO)
  /*
!  * The 'showbreak' option is changed.
   */
      char *
! did_set_showbreak(optset_T *args)
  {
!     char_u    *s;
! 
!     for (s = args->os_varp; *s; )
!     {
!       if (ptr2cells(s) != 1)
!           return e_showbreak_contains_unprintable_or_wide_character;
!       MB_PTR_ADV(s);
!     }
  
      return NULL;
  }
  #endif
  
  /*
!  * The 'showcmdloc' option is changed.
   */
      char *
! did_set_showcmdloc(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_sloc, p_sloc_values, FALSE);
  }
  
+ #if defined(FEAT_SIGNS) || defined(PROTO)
  /*
!  * The 'signcolumn' option is changed.
   */
      char *
! did_set_signcolumn(optset_T *args)
  {
!     if (check_opt_strings(args->os_varp, p_scl_values, FALSE) != OK)
        return e_invalid_argument;
+     // When changing the 'signcolumn' to or from 'number', recompute the
+     // width of the number column if 'number' or 'relativenumber' is set.
+     if (((*args->os_oldval.string == 'n' && args->os_oldval.string[1] == 'u')
+               || (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) =='u'))
+           && (curwin->w_p_nu || curwin->w_p_rnu))
+       curwin->w_nrwidth_line_count = 0;
  
      return NULL;
  }
+ #endif
  
+ #if defined(FEAT_SPELL) || defined(PROTO)
  /*
!  * The 'spellcapcheck' option is changed.
   */
      char *
! did_set_spellcapcheck(optset_T *args UNUSED)
  {
!     // compile the regexp program.
!     return compile_cap_prog(curwin->w_s);
  }
  
  /*
!  * The 'spellfile' option is changed.
   */
      char *
! did_set_spellfile(optset_T *args)
  {
!     if (!valid_spellfile(args->os_varp))
        return e_invalid_argument;
  
!     // If there is a window for this buffer in which 'spell' is set load the
!     // wordlists.
!     return did_set_spell_option(TRUE);
  }
  
  /*
!  * The 'spell' option is changed.
   */
      char *
! did_set_spelllang(optset_T *args)
  {
!     if (!valid_spelllang(args->os_varp))
        return e_invalid_argument;
  
!     // If there is a window for this buffer in which 'spell' is set load the
!     // wordlists.
!     return did_set_spell_option(FALSE);
  }
  
  /*
!  * The 'spelloptions' option is changed.
   */
      char *
! did_set_spelloptions(optset_T *args)
  {
!     if (*args->os_varp != NUL && STRCMP("camel", args->os_varp) != 0)
        return e_invalid_argument;
  
      return NULL;
  }
  
  /*
!  * The 'spellsuggest' option is changed.
   */
      char *
! did_set_spellsuggest(optset_T *args UNUSED)
  {
!     if (spell_check_sps() != OK)
        return e_invalid_argument;
  
      return NULL;
  }
+ #endif
  
  /*
!  * The 'splitkeep' option is changed.
   */
      char *
! did_set_splitkeep(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_spk, p_spk_values, FALSE);
! }
  
! #if defined(FEAT_STL_OPT) || defined(PROTO)
! /*
!  * The 'statusline' option is changed.
!  */
!     char *
! did_set_statusline(optset_T *args)
! {
!     return parse_statustabline_rulerformat(args, FALSE);
  }
+ #endif
  
  /*
!  * The 'swapsync' option is changed.
   */
      char *
! did_set_swapsync(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_sws, p_sws_values, FALSE);
  }
  
  /*
!  * The 'switchbuf' option is changed.
   */
      char *
! did_set_switchbuf(optset_T *args UNUSED)
  {
!     return did_set_opt_flags(p_swb, p_swb_values, &swb_flags, TRUE);
  }
  
+ #if defined(FEAT_STL_OPT) || defined(PROTO)
  /*
!  * The 'tabline' option is changed.
   */
      char *
! did_set_tabline(optset_T *args)
  {
!     return parse_statustabline_rulerformat(args, FALSE);
  }
  #endif
  
  /*
!  * The 'tagcase' option is changed.
   */
      char *
! did_set_tagcase(optset_T *args)
  {
!     unsigned int      *flags;
!     char_u            *p;
  
      if (args->os_flags & OPT_LOCAL)
      {
!       p = curbuf->b_p_tc;
!       flags = &curbuf->b_tc_flags;
      }
      else
      {
!       p = p_tc;
!       flags = &tc_flags;
      }
  
+     if ((args->os_flags & OPT_LOCAL) && *p == NUL)
+       // make the local value empty: use the global value
+       *flags = 0;
+     else if (*p == NUL
+           || opt_strings_flags(p, p_tc_values, flags, FALSE) != OK)
+       return e_invalid_argument;
+ 
      return NULL;
  }
  
  /*
!  * The 'term' option is changed.
   */
!     static char *
! did_set_term(int *opt_idx, long_u *free_oldval)
  {
!     char *errmsg = NULL;
  
!     if (T_NAME[0] == NUL)
!       errmsg = e_cannot_set_term_to_empty_string;
! #ifdef FEAT_GUI
!     else if (gui.in_use)
!       errmsg = e_cannot_change_term_in_GUI;
!     else if (term_is_gui(T_NAME))
!       errmsg = e_use_gui_to_start_GUI;
! #endif
!     else if (set_termname(T_NAME) == FAIL)
!       errmsg = e_not_found_in_termcap;
!     else
      {
!       // Screen colors may have changed.
!       redraw_later_clear();
! 
!       // Both 'term' and 'ttytype' point to T_NAME, only set the
!       // P_ALLOCED flag on 'term'.
!       *opt_idx = findoption((char_u *)"term");
!       if (*opt_idx >= 0)
!           *free_oldval = (get_option_flags(*opt_idx) & P_ALLOCED);
      }
  
!     return errmsg;
  }
  
  /*
!  * Some terminal option (t_xxx) is changed
   */
!     static void
! did_set_term_option(char_u **varp, int *did_swaptcap UNUSED)
  {
!     // ":set t_Co=0" and ":set t_Co=1" do ":set t_Co="
!     if (varp == &T_CCO)
!     {
!       int colors = atoi((char *)T_CCO);
  
!       // Only reinitialize colors if t_Co value has really changed to
!       // avoid expensive reload of colorscheme if t_Co is set to the
!       // same value multiple times.
!       if (colors != t_colors)
!       {
!           t_colors = colors;
!           if (t_colors <= 1)
!           {
!               vim_free(T_CCO);
!               T_CCO = empty_option;
!           }
! #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
!           if (is_term_win32())
!           {
!               swap_tcap();
!               *did_swaptcap = TRUE;
!           }
! #endif
!           // We now have a different color setup, initialize it again.
!           init_highlight(TRUE, FALSE);
!       }
!     }
!     ttest(FALSE);
!     if (varp == &T_ME)
!     {
!       out_str(T_ME);
!       redraw_later(UPD_CLEAR);
! #if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
!       // Since t_me has been set, this probably means that the user
!       // wants to use this as default colors.  Need to reset default
!       // background/foreground colors.
! # ifdef VIMDLL
!       if (!gui.in_use && !gui.starting)
! # endif
!           mch_set_normal_colors();
! #endif
!     }
!     if (varp == &T_BE && termcap_active)
!     {
!       MAY_WANT_TO_LOG_THIS;
! 
!       if (*T_BE == NUL)
!           // When clearing t_BE we assume the user no longer wants
!           // bracketed paste, thus disable it by writing t_BD.
!           out_str(T_BD);
!       else
!           out_str(T_BE);
!     }
  }
  
+ #if defined(FEAT_TERMINAL) || defined(PROTO)
  /*
!  * The 'termwinkey' option is changed.
   */
      char *
! did_set_termwinkey(optset_T *args UNUSED)
  {
!     if (*curwin->w_p_twk != NUL
!           && string_to_key(curwin->w_p_twk, TRUE) == 0)
        return e_invalid_argument;
  
      return NULL;
  }
  
  /*
!  * The 'termwinsize' option is changed.
   */
      char *
! did_set_termwinsize(optset_T *args UNUSED)
  {
!     char_u    *p;
! 
!     if (*curwin->w_p_tws == NUL)
!       return NULL;
! 
!     p = skipdigits(curwin->w_p_tws);
!     if (p == curwin->w_p_tws
!           || (*p != 'x' && *p != '*')
!           || *skipdigits(p + 1) != NUL)
        return e_invalid_argument;
  
      return NULL;
  }
  
! # if defined(MSWIN) || defined(PROTO)
  /*
!  * The 'termwintype' option is changed.
   */
      char *
! did_set_termwintype(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_twt, p_twt_values, FALSE);
  }
+ # endif
  #endif
  
  /*
!  * The 'titlestring' option is changed.
   */
      char *
! did_set_titlestring(optset_T *args)
  {
!     int flagval = 0;
  
! #ifdef FEAT_STL_OPT
!     flagval = STL_IN_TITLE;
! #endif
!     return parse_titleiconstring(args, flagval);
  }
  
! #if (defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)) || defined(PROTO)
  /*
!  * The 'toolbar' option is changed.
   */
      char *
! did_set_toolbar(optset_T *args UNUSED)
  {
!     if (opt_strings_flags(p_toolbar, p_toolbar_values,
!               &toolbar_flags, TRUE) != OK)
        return e_invalid_argument;
  
+     out_flush();
+     gui_mch_show_toolbar((toolbar_flags &
+               (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
      return NULL;
  }
+ #endif
  
+ #if (defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)) || defined(PROTO)
  /*
!  * The 'toolbariconsize' option is changed.  GTK+ 2 only.
   */
      char *
! did_set_toolbariconsize(optset_T *args UNUSED)
  {
!     if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK)
        return e_invalid_argument;
  
+     out_flush();
+     gui_mch_show_toolbar((toolbar_flags &
+               (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
      return NULL;
  }
+ #endif
  
! #if defined(UNIX) || defined(VMS) || defined(PROTO)
  /*
!  * The 'ttymouse' option is changed.
   */
      char *
! did_set_ttymouse(optset_T *args UNUSED)
  {
!     char *errmsg = NULL;
! 
!     // Switch the mouse off before changing the escape sequences used for
!     // that.
!     mch_setmouse(FALSE);
!     if (opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE) != OK)
!       errmsg = e_invalid_argument;
!     else
!       check_mouse_termcode();
!     if (termcap_active)
!       setmouse();             // may switch it on again
! 
!     return errmsg;
  }
  #endif
  
  #if defined(FEAT_VARTABS) || defined(PROTO)
***************
*** 2771,2936 ****
  }
  #endif
  
- #if defined(FEAT_PROP_POPUP) || defined(PROTO)
  /*
!  * The 'previewpopup' option is changed.
   */
      char *
! did_set_previewpopup(optset_T *args UNUSED)
  {
!     if (parse_previewpopup(NULL) == FAIL)
        return e_invalid_argument;
  
      return NULL;
  }
  
! # if defined(FEAT_QUICKFIX) || defined(PROTO)
  /*
!  * The 'completepopup' option is changed.
   */
      char *
! did_set_completepopup(optset_T *args UNUSED)
  {
!     if (parse_completepopup(NULL) == FAIL)
!       return e_invalid_argument;
! 
!     popup_close_info();
!     return NULL;
  }
- # endif
  #endif
  
! #if defined(FEAT_EVAL) || defined(PROTO)
! /*
!  * Returns TRUE if the option pointed by "varp" or "gvarp" is one of the
!  * '*expr' options: 'balloonexpr', 'diffexpr', 'foldexpr', 'foldtext',
!  * 'formatexpr', 'includeexpr', 'indentexpr', 'patchexpr', 'printexpr' or
!  * 'charconvert'.
!  */
!     static int
! is_expr_option(char_u **varp, char_u **gvarp)
! {
!     return (
! # ifdef FEAT_BEVAL
!       varp == &p_bexpr ||                     // 'balloonexpr'
! # endif
! # ifdef FEAT_DIFF
!       varp == &p_dex ||                       // 'diffexpr'
! # endif
! # ifdef FEAT_FOLDING
!       gvarp == &curwin->w_allbuf_opt.wo_fde ||        // 'foldexpr'
!       gvarp == &curwin->w_allbuf_opt.wo_fdt ||        // 'foldtext'
! # endif
!       gvarp == &p_fex ||                      // 'formatexpr'
! # ifdef FEAT_FIND_ID
!       gvarp == &p_inex ||                     // 'includeexpr'
! # endif
!       gvarp == &p_inde ||                     // 'indentexpr'
! # ifdef FEAT_DIFF
!       varp == &p_pex ||                       // 'patchexpr'
! # endif
! # ifdef FEAT_POSTSCRIPT
!       varp == &p_pexpr ||                     // 'printexpr'
! # endif
!       varp == &p_ccv);                        // 'charconvert'
! }
! 
  /*
!  * One of the '*expr' options is changed: 'balloonexpr', 'diffexpr',
!  * 'foldexpr', 'foldtext', 'formatexpr', 'includeexpr', 'indentexpr',
!  * 'patchexpr', 'printexpr' and 'charconvert'.
!  *
   */
      char *
! did_set_optexpr(optset_T *args)
  {
!     // If the option value starts with <SID> or s:, then replace that with
!     // the script identifier.
!     char_u *name = get_scriptlocal_funcname(args->os_varp);
!     if (name != NULL)
      {
!       free_string_option(args->os_varp);
!       args->os_varp = name;
      }
  
!     return NULL;
  }
  
- # if defined(FEAT_FOLDING) || defined(PROTO)
  /*
!  * The 'foldexpr' option is changed.
   */
      char *
! did_set_foldexpr(optset_T *args)
  {
!     (void)did_set_optexpr(args);
!     if (foldmethodIsExpr(curwin))
!       foldUpdateAll(curwin);
      return NULL;
  }
- # endif
- #endif
  
- #if defined(FEAT_CONCEAL) || defined(PROTO)
  /*
!  * The 'concealcursor' option is changed.
   */
      char *
! did_set_concealcursor(optset_T *args)
  {
!     return did_set_option_listflag(args->os_varp, (char_u *)COCU_ALL,
                                                        args->os_errbuf);
  }
- #endif
  
  /*
!  * The 'cpoptions' option is changed.
   */
      char *
! did_set_cpoptions(optset_T *args)
  {
!     return did_set_option_listflag(args->os_varp, (char_u *)CPO_ALL,
!                                                       args->os_errbuf);
  }
  
  /*
!  * The 'formatoptions' option is changed.
   */
      char *
! did_set_formatoptions(optset_T *args)
  {
!     return did_set_option_listflag(args->os_varp, (char_u *)FO_ALL,
!                                                       args->os_errbuf);
  }
  
  /*
!  * The 'mouse' option is changed.
   */
      char *
! did_set_mouse(optset_T *args)
  {
!     return did_set_option_listflag(args->os_varp, (char_u *)MOUSE_ALL,
!                                                       args->os_errbuf);
! }
  
! /*
!  * The 'shortmess' option is changed.
!  */
!     char *
! did_set_shortmess(optset_T *args)
! {
!     return did_set_option_listflag(args->os_varp, (char_u *)SHM_ALL,
!                                                       args->os_errbuf);
  }
  
  /*
!  * The 'whichwrap' option is changed.
   */
      char *
! did_set_whichwrap(optset_T *args)
  {
!     return did_set_option_listflag(args->os_varp, (char_u *)WW_ALL,
!                                                       args->os_errbuf);
  }
  
  #ifdef FEAT_SYN_HL
--- 2753,2951 ----
  }
  #endif
  
  /*
!  * The 'verbosefile' option is changed.
   */
      char *
! did_set_verbosefile(optset_T *args UNUSED)
  {
!     verbose_stop();
!     if (*p_vfile != NUL && verbose_open() == FAIL)
        return e_invalid_argument;
  
      return NULL;
  }
  
! #if defined(FEAT_SESSION) || defined(PROTO)
  /*
!  * The 'viewoptions' option is changed.
   */
      char *
! did_set_viewoptions(optset_T *args UNUSED)
  {
!     return did_set_opt_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
  }
  #endif
  
! #if defined(FEAT_VIMINFO) || defined(PROTO)
  /*
!  * The 'viminfo' option is changed.
   */
      char *
! did_set_viminfo(optset_T *args)
  {
!     char_u    *s;
!     char      *errmsg = NULL;
! 
!     for (s = p_viminfo; *s;)
      {
!       // Check it's a valid character
!       if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL)
!       {
!           errmsg = illegal_char(args->os_errbuf, *s);
!           break;
!       }
!       if (*s == 'n')  // name is always last one
!           break;
!       else if (*s == 'r') // skip until next ','
!       {
!           while (*++s && *s != ',')
!               ;
!       }
!       else if (*s == '%')
!       {
!           // optional number
!           while (vim_isdigit(*++s))
!               ;
!       }
!       else if (*s == '!' || *s == 'h' || *s == 'c')
!           ++s;                // no extra chars
!       else            // must have a number
!       {
!           while (vim_isdigit(*++s))
!               ;
! 
!           if (!VIM_ISDIGIT(*(s - 1)))
!           {
!               if (args->os_errbuf != NULL)
!               {
!                   sprintf(args->os_errbuf,
!                           _(e_missing_number_after_angle_str_angle),
!                           transchar_byte(*(s - 1)));
!                   errmsg = args->os_errbuf;
!               }
!               else
!                   errmsg = "";
!               break;
!           }
!       }
!       if (*s == ',')
!           ++s;
!       else if (*s)
!       {
!           if (args->os_errbuf != NULL)
!               errmsg = e_missing_comma;
!           else
!               errmsg = "";
!           break;
!       }
      }
+     if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0)
+       errmsg = e_must_specify_a_value;
  
!     return errmsg;
  }
+ #endif
  
  /*
!  * The 'virtualedit' option is changed.
   */
      char *
! did_set_virtualedit(optset_T *args)
  {
!     char_u            *ve = p_ve;
!     unsigned int      *flags = &ve_flags;
! 
!     if (args->os_flags & OPT_LOCAL)
!     {
!       ve = curwin->w_p_ve;
!       flags = &curwin->w_ve_flags;
!     }
! 
!     if ((args->os_flags & OPT_LOCAL) && *ve == NUL)
!       // make the local value empty: use the global value
!       *flags = 0;
!     else
!     {
!       if (opt_strings_flags(ve, p_ve_values, flags, TRUE) != OK)
!           return e_invalid_argument;
!       else if (STRCMP(ve, args->os_oldval.string) != 0)
!       {
!           // Recompute cursor position in case the new 've' setting
!           // changes something.
!           validate_virtcol();
!           coladvance(curwin->w_virtcol);
!       }
!     }
! 
      return NULL;
  }
  
  /*
!  * The 'whichwrap' option is changed.
   */
      char *
! did_set_whichwrap(optset_T *args)
  {
!     return did_set_option_listflag(args->os_varp, (char_u *)WW_ALL,
                                                        args->os_errbuf);
  }
  
  /*
!  * The 'wildmode' option is changed.
   */
      char *
! did_set_wildmode(optset_T *args UNUSED)
  {
!     if (check_opt_wim() == FAIL)
!       return e_invalid_argument;
!     return NULL;
  }
  
  /*
!  * The 'wildoptions' option is changed.
   */
      char *
! did_set_wildoptions(optset_T *args UNUSED)
  {
!     return did_set_opt_strings(p_wop, p_wop_values, TRUE);
  }
  
+ #if defined(FEAT_WAK) || defined(PROTO)
  /*
!  * The 'winaltkeys' option is changed.
   */
      char *
! did_set_winaltkeys(optset_T *args UNUSED)
  {
!     char *errmsg = NULL;
  
!     if (*p_wak == NUL
!           || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
!       errmsg = e_invalid_argument;
! # ifdef FEAT_MENU
! #  if defined(FEAT_GUI_MOTIF)
!     else if (gui.in_use)
!       gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
! #  elif defined(FEAT_GUI_GTK)
!     else if (gui.in_use)
!       gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
! #  endif
! # endif
!     return errmsg;
  }
+ #endif
  
  /*
!  * The 'wincolor' option is changed.
   */
      char *
! did_set_wincolor(optset_T *args UNUSED)
  {
! #ifdef FEAT_TERMINAL
!     term_update_wincolor(curwin);
! #endif
!     return NULL;
  }
  
  #ifdef FEAT_SYN_HL
*** ../vim-9.0.1365/src/proto/optionstr.pro     2023-02-27 12:47:44.107282452 
+0000
--- src/proto/optionstr.pro     2023-03-01 12:43:13.107829946 +0000
***************
*** 9,121 ****
  void set_string_option_direct_in_win(win_T *wp, char_u *name, int opt_idx, 
char_u *val, int opt_flags, int set_sid);
  void set_string_option_direct_in_buf(buf_T *buf, char_u *name, int opt_idx, 
char_u *val, int opt_flags, int set_sid);
  char *set_string_option(int opt_idx, char_u *value, int opt_flags, char 
*errbuf);
  char *did_set_backupcopy(optset_T *args);
  char *did_set_backupext_or_patchmode(optset_T *args);
  char *did_set_breakindentopt(optset_T *args);
! char *did_set_isopt(optset_T *args);
! char *did_set_helpfile(optset_T *args);
  char *did_set_colorcolumn(optset_T *args);
  char *did_set_cursorlineopt(optset_T *args);
! char *did_set_helplang(optset_T *args);
! char *did_set_highlight(optset_T *args);
! char *did_set_belloff(optset_T *args);
! char *did_set_casemap(optset_T *args);
! char *did_set_scrollopt(optset_T *args);
! char *did_set_selectmode(optset_T *args);
! char *did_set_showcmdloc(optset_T *args);
! char *did_set_splitkeep(optset_T *args);
! char *did_set_swapsync(optset_T *args);
! char *did_set_switchbuf(optset_T *args);
! char *did_set_sessionoptions(optset_T *args);
! char *did_set_viewoptions(optset_T *args);
! char *did_set_ambiwidth(optset_T *args);
! char *did_set_background(optset_T *args);
! char *did_set_wildmode(optset_T *args);
! char *did_set_wildoptions(optset_T *args);
! char *did_set_winaltkeys(optset_T *args);
! char *did_set_wincolor(optset_T *args);
  char *did_set_eadirection(optset_T *args);
  char *did_set_eventignore(optset_T *args);
- char *did_set_printencoding(optset_T *args);
- char *did_set_imactivatekey(optset_T *args);
- char *did_set_keymap(optset_T *args);
  char *did_set_fileformat(optset_T *args);
  char *did_set_fileformats(optset_T *args);
! char *did_set_cryptkey(optset_T *args);
! char *did_set_cryptmethod(optset_T *args);
! char *did_set_matchpairs(optset_T *args);
! char *did_set_comments(optset_T *args);
! char *did_set_verbosefile(optset_T *args);
! char *did_set_viminfo(optset_T *args);
! char *did_set_showbreak(optset_T *args);
  char *did_set_guicursor(optset_T *args);
  char *did_set_guifont(optset_T *args);
  char *did_set_guifontset(optset_T *args);
  char *did_set_guifontwide(optset_T *args);
  char *did_set_guiligatures(optset_T *args);
- char *did_set_mouseshape(optset_T *args);
- char *did_set_titlestring(optset_T *args);
- char *did_set_iconstring(optset_T *args);
  char *did_set_guioptions(optset_T *args);
  char *did_set_guitablabel(optset_T *args);
! char *did_set_ttymouse(optset_T *args);
! char *did_set_selection(optset_T *args);
! char *did_set_browsedir(optset_T *args);
  char *did_set_keymodel(optset_T *args);
  char *did_set_keyprotocol(optset_T *args);
  char *did_set_mousemodel(optset_T *args);
! char *did_set_debug(optset_T *args);
! char *did_set_display(optset_T *args);
  char *did_set_spellfile(optset_T *args);
  char *did_set_spelllang(optset_T *args);
- char *did_set_spellcapcheck(optset_T *args);
  char *did_set_spelloptions(optset_T *args);
  char *did_set_spellsuggest(optset_T *args);
! char *did_set_mkspellmem(optset_T *args);
! char *did_set_nrformats(optset_T *args);
! char *did_set_buftype(optset_T *args);
  char *did_set_statusline(optset_T *args);
  char *did_set_tabline(optset_T *args);
- char *did_set_rulerformat(optset_T *args);
- char *did_set_complete(optset_T *args);
- char *did_set_completeopt(optset_T *args);
- char *did_set_completeslash(optset_T *args);
- char *did_set_signcolumn(optset_T *args);
- char *did_set_toolbar(optset_T *args);
- char *did_set_toolbariconsize(optset_T *args);
- char *did_set_pastetoggle(optset_T *args);
- char *did_set_backspace(optset_T *args);
- char *did_set_bufhidden(optset_T *args);
  char *did_set_tagcase(optset_T *args);
- char *did_set_diffopt(optset_T *args);
- char *did_set_foldmethod(optset_T *args);
- char *did_set_foldmarker(optset_T *args);
- char *did_set_commentstring(optset_T *args);
- char *did_set_foldignore(optset_T *args);
- char *did_set_foldclose(optset_T *args);
- char *did_set_foldopen(optset_T *args);
- char *did_set_virtualedit(optset_T *args);
- char *did_set_cscopequickfix(optset_T *args);
- char *did_set_cinoptions(optset_T *args);
- char *did_set_lispoptions(optset_T *args);
- char *did_set_renderoptions(optset_T *args);
- char *did_set_rightleftcmd(optset_T *args);
- char *did_set_filetype_or_syntax(optset_T *args);
  char *did_set_termwinkey(optset_T *args);
  char *did_set_termwinsize(optset_T *args);
  char *did_set_termwintype(optset_T *args);
  char *did_set_varsofttabstop(optset_T *args);
  char *did_set_vartabstop(optset_T *args);
! char *did_set_previewpopup(optset_T *args);
! char *did_set_completepopup(optset_T *args);
! char *did_set_optexpr(optset_T *args);
! char *did_set_foldexpr(optset_T *args);
! char *did_set_concealcursor(optset_T *args);
! char *did_set_cpoptions(optset_T *args);
! char *did_set_formatoptions(optset_T *args);
! char *did_set_mouse(optset_T *args);
! char *did_set_shortmess(optset_T *args);
  char *did_set_whichwrap(optset_T *args);
  char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, 
char_u *value, char *errbuf, int opt_flags, int *value_checked);
  int check_ff_value(char_u *p);
  void save_clear_shm_value(void);
--- 9,121 ----
  void set_string_option_direct_in_win(win_T *wp, char_u *name, int opt_idx, 
char_u *val, int opt_flags, int set_sid);
  void set_string_option_direct_in_buf(buf_T *buf, char_u *name, int opt_idx, 
char_u *val, int opt_flags, int set_sid);
  char *set_string_option(int opt_idx, char_u *value, int opt_flags, char 
*errbuf);
+ char *did_set_ambiwidth(optset_T *args);
+ char *did_set_background(optset_T *args);
+ char *did_set_backspace(optset_T *args);
  char *did_set_backupcopy(optset_T *args);
  char *did_set_backupext_or_patchmode(optset_T *args);
+ char *did_set_belloff(optset_T *args);
  char *did_set_breakindentopt(optset_T *args);
! char *did_set_browsedir(optset_T *args);
! char *did_set_bufhidden(optset_T *args);
! char *did_set_buftype(optset_T *args);
! char *did_set_casemap(optset_T *args);
! char *did_set_cinoptions(optset_T *args);
  char *did_set_colorcolumn(optset_T *args);
+ char *did_set_comments(optset_T *args);
+ char *did_set_commentstring(optset_T *args);
+ char *did_set_complete(optset_T *args);
+ char *did_set_completeopt(optset_T *args);
+ char *did_set_completepopup(optset_T *args);
+ char *did_set_completeslash(optset_T *args);
+ char *did_set_concealcursor(optset_T *args);
+ char *did_set_cpoptions(optset_T *args);
+ char *did_set_cryptkey(optset_T *args);
+ char *did_set_cryptmethod(optset_T *args);
+ char *did_set_cscopequickfix(optset_T *args);
  char *did_set_cursorlineopt(optset_T *args);
! char *did_set_debug(optset_T *args);
! char *did_set_diffopt(optset_T *args);
! char *did_set_display(optset_T *args);
  char *did_set_eadirection(optset_T *args);
  char *did_set_eventignore(optset_T *args);
  char *did_set_fileformat(optset_T *args);
  char *did_set_fileformats(optset_T *args);
! char *did_set_filetype_or_syntax(optset_T *args);
! char *did_set_foldclose(optset_T *args);
! char *did_set_foldexpr(optset_T *args);
! char *did_set_foldignore(optset_T *args);
! char *did_set_foldmarker(optset_T *args);
! char *did_set_foldmethod(optset_T *args);
! char *did_set_foldopen(optset_T *args);
! char *did_set_formatoptions(optset_T *args);
  char *did_set_guicursor(optset_T *args);
  char *did_set_guifont(optset_T *args);
  char *did_set_guifontset(optset_T *args);
  char *did_set_guifontwide(optset_T *args);
  char *did_set_guiligatures(optset_T *args);
  char *did_set_guioptions(optset_T *args);
  char *did_set_guitablabel(optset_T *args);
! char *did_set_helpfile(optset_T *args);
! char *did_set_helplang(optset_T *args);
! char *did_set_highlight(optset_T *args);
! char *did_set_iconstring(optset_T *args);
! char *did_set_imactivatekey(optset_T *args);
! char *did_set_isopt(optset_T *args);
! char *did_set_keymap(optset_T *args);
  char *did_set_keymodel(optset_T *args);
  char *did_set_keyprotocol(optset_T *args);
+ char *did_set_lispoptions(optset_T *args);
+ char *did_set_matchpairs(optset_T *args);
+ char *did_set_mkspellmem(optset_T *args);
+ char *did_set_mouse(optset_T *args);
  char *did_set_mousemodel(optset_T *args);
! char *did_set_mouseshape(optset_T *args);
! char *did_set_nrformats(optset_T *args);
! char *did_set_optexpr(optset_T *args);
! char *did_set_pastetoggle(optset_T *args);
! char *did_set_previewpopup(optset_T *args);
! char *did_set_printencoding(optset_T *args);
! char *did_set_renderoptions(optset_T *args);
! char *did_set_rightleftcmd(optset_T *args);
! char *did_set_rulerformat(optset_T *args);
! char *did_set_scrollopt(optset_T *args);
! char *did_set_selection(optset_T *args);
! char *did_set_selectmode(optset_T *args);
! char *did_set_sessionoptions(optset_T *args);
! char *did_set_shortmess(optset_T *args);
! char *did_set_showbreak(optset_T *args);
! char *did_set_showcmdloc(optset_T *args);
! char *did_set_signcolumn(optset_T *args);
! char *did_set_spellcapcheck(optset_T *args);
  char *did_set_spellfile(optset_T *args);
  char *did_set_spelllang(optset_T *args);
  char *did_set_spelloptions(optset_T *args);
  char *did_set_spellsuggest(optset_T *args);
! char *did_set_splitkeep(optset_T *args);
  char *did_set_statusline(optset_T *args);
+ char *did_set_swapsync(optset_T *args);
+ char *did_set_switchbuf(optset_T *args);
  char *did_set_tabline(optset_T *args);
  char *did_set_tagcase(optset_T *args);
  char *did_set_termwinkey(optset_T *args);
  char *did_set_termwinsize(optset_T *args);
  char *did_set_termwintype(optset_T *args);
+ char *did_set_titlestring(optset_T *args);
+ char *did_set_toolbar(optset_T *args);
+ char *did_set_toolbariconsize(optset_T *args);
+ char *did_set_ttymouse(optset_T *args);
  char *did_set_varsofttabstop(optset_T *args);
  char *did_set_vartabstop(optset_T *args);
! char *did_set_verbosefile(optset_T *args);
! char *did_set_viewoptions(optset_T *args);
! char *did_set_viminfo(optset_T *args);
! char *did_set_virtualedit(optset_T *args);
  char *did_set_whichwrap(optset_T *args);
+ char *did_set_wildmode(optset_T *args);
+ char *did_set_wildoptions(optset_T *args);
+ char *did_set_winaltkeys(optset_T *args);
+ char *did_set_wincolor(optset_T *args);
  char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, 
char_u *value, char *errbuf, int opt_flags, int *value_checked);
  int check_ff_value(char_u *p);
  void save_clear_shm_value(void);
*** ../vim-9.0.1365/src/version.c       2023-02-28 16:02:32.191548857 +0000
--- src/version.c       2023-03-01 12:43:01.675768233 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1366,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
201. When somebody asks you where you are, you tell them in which chat room.

 /// Bram Moolenaar -- [email protected] -- 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230301124539.1B4131C0491%40moolenaar.net.

Raspunde prin e-mail lui