Patch 8.0.0649
Problem:    When opening a help file the filetype is set several times.
Solution:   When setting the filetype to the same value from a modeline, don't
            trigger FileType autocommands.  Don't set the filetype to "help"
            when it's already set correctly.
Files:      src/ex_cmds.c, src/option.c, runtime/filetype.vim


*** ../vim-8.0.0648/src/ex_cmds.c       2017-06-17 18:44:16.990001010 +0200
--- src/ex_cmds.c       2017-06-20 22:35:20.897972252 +0200
***************
*** 6832,6839 ****
      char_u    *rt;
      int               mustfree;
  
!     /* set filetype to "help". */
!     set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL);
  
  #ifdef FEAT_SYN_HL
      if (!syntax_present(curwin))
--- 6832,6840 ----
      char_u    *rt;
      int               mustfree;
  
!     /* Set filetype to "help" if still needed. */
!     if (STRCMP(curbuf->b_p_ft, "help") != 0)
!       set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL);
  
  #ifdef FEAT_SYN_HL
      if (!syntax_present(curwin))
*** ../vim-8.0.0648/src/option.c        2017-06-13 17:20:35.683782375 +0200
--- src/option.c        2017-06-20 22:32:38.067348086 +0200
***************
*** 6009,6014 ****
--- 6009,6017 ----
      /* set when changing an option that only requires a redraw in the GUI */
      int               redraw_gui_only = FALSE;
  #endif
+ #ifdef FEAT_AUTOCMD
+     int               ft_changed = FALSE;
+ #endif
  
      /* Get the global option to compare with, otherwise we would have to check
       * two values for all local options. */
***************
*** 7418,7423 ****
--- 7421,7428 ----
      {
        if (!valid_filetype(*varp))
            errmsg = e_invarg;
+       else
+           ft_changed = STRCMP(oldval, *varp) != 0;
      }
  #endif
  
***************
*** 7531,7540 ****
  # endif
        else if (varp == &(curbuf->b_p_ft))
        {
!           /* 'filetype' is set, trigger the FileType autocommand */
!           did_filetype = TRUE;
!           apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft,
                                               curbuf->b_fname, TRUE, curbuf);
        }
  #endif
  #ifdef FEAT_SPELL
--- 7536,7550 ----
  # endif
        else if (varp == &(curbuf->b_p_ft))
        {
!           /* 'filetype' is set, trigger the FileType autocommand.
!            * Skip this when called from a modeline and the filetype was
!            * already set to this value. */
!           if (!(opt_flags & OPT_MODELINE) || ft_changed)
!           {
!               did_filetype = TRUE;
!               apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft,
                                               curbuf->b_fname, TRUE, curbuf);
+           }
        }
  #endif
  #ifdef FEAT_SPELL
*** ../vim-8.0.0648/runtime/filetype.vim        2017-06-04 18:59:10.787459123 
+0200
--- runtime/filetype.vim        2017-06-20 22:12:03.073161565 +0200
***************
*** 48,53 ****
--- 48,56 ----
    endif
  endfunc
  
+ " Vim help file
+ au BufNewFile,BufRead $VIMRUNTIME/doc/*.txt   setf help
+ 
  " Abaqus or Trasys
  au BufNewFile,BufRead *.inp                   call s:Check_inp()
  
*** ../vim-8.0.0648/src/version.c       2017-06-19 20:35:28.423401990 +0200
--- src/version.c       2017-06-22 14:14:53.445536099 +0200
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     649,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
56. You leave the modem speaker on after connecting because you think it
    sounds like the ocean wind...the perfect soundtrack for "surfing the net".

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui