073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.515
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.515
073263
Problem:    In a help buffer the global 'foldmethod' is used.  (Paul Marshall)
073263
Solution:   Reset 'foldmethod' when starting to edit a help file.  Move the
073263
	    code to a separate function.
073263
Files:	    src/ex_cmds.c
073263
073263
073263
*** ../vim-7.4.514/src/ex_cmds.c	2014-09-19 22:23:22.398467500 +0200
073263
--- src/ex_cmds.c	2014-11-12 19:23:48.357576278 +0100
073263
***************
073263
*** 34,39 ****
073263
--- 34,40 ----
073263
      _RTLENTRYF
073263
  #endif
073263
  	help_compare __ARGS((const void *s1, const void *s2));
073263
+ static void prepare_help_buffer __ARGS((void));
073263
  
073263
  /*
073263
   * ":ascii" and "ga".
073263
***************
073263
*** 3531,3601 ****
073263
  	oldbuf = (flags & ECMD_OLDBUF);
073263
      }
073263
  
073263
-     if ((flags & ECMD_SET_HELP) || keep_help_flag)
073263
-     {
073263
- 	char_u	*p;
073263
- 
073263
- 	curbuf->b_help = TRUE;
073263
- #ifdef FEAT_QUICKFIX
073263
- 	set_string_option_direct((char_u *)"buftype", -1,
073263
- 				     (char_u *)"help", OPT_FREE|OPT_LOCAL, 0);
073263
- #endif
073263
- 
073263
- 	/*
073263
- 	 * Always set these options after jumping to a help tag, because the
073263
- 	 * user may have an autocommand that gets in the way.
073263
- 	 * Accept all ASCII chars for keywords, except ' ', '*', '"', '|', and
073263
- 	 * latin1 word characters (for translated help files).
073263
- 	 * Only set it when needed, buf_init_chartab() is some work.
073263
- 	 */
073263
- 	p =
073263
- #ifdef EBCDIC
073263
- 		(char_u *)"65-255,^*,^|,^\"";
073263
- #else
073263
- 		(char_u *)"!-~,^*,^|,^\",192-255";
073263
- #endif
073263
- 	if (STRCMP(curbuf->b_p_isk, p) != 0)
073263
- 	{
073263
- 	    set_string_option_direct((char_u *)"isk", -1, p,
073263
- 						       OPT_FREE|OPT_LOCAL, 0);
073263
- 	    check_buf_options(curbuf);
073263
- 	    (void)buf_init_chartab(curbuf, FALSE);
073263
- 	}
073263
- 
073263
- 	curbuf->b_p_ts = 8;		/* 'tabstop' is 8 */
073263
- 	curwin->w_p_list = FALSE;	/* no list mode */
073263
- 
073263
- 	curbuf->b_p_ma = FALSE;		/* not modifiable */
073263
- 	curbuf->b_p_bin = FALSE;	/* reset 'bin' before reading file */
073263
- 	curwin->w_p_nu = 0;		/* no line numbers */
073263
- 	curwin->w_p_rnu = 0;		/* no relative line numbers */
073263
- 	RESET_BINDING(curwin);		/* no scroll or cursor binding */
073263
- #ifdef FEAT_ARABIC
073263
- 	curwin->w_p_arab = FALSE;	/* no arabic mode */
073263
- #endif
073263
- #ifdef FEAT_RIGHTLEFT
073263
- 	curwin->w_p_rl  = FALSE;	/* help window is left-to-right */
073263
- #endif
073263
- #ifdef FEAT_FOLDING
073263
- 	curwin->w_p_fen = FALSE;	/* No folding in the help window */
073263
- #endif
073263
- #ifdef FEAT_DIFF
073263
- 	curwin->w_p_diff = FALSE;	/* No 'diff' */
073263
- #endif
073263
- #ifdef FEAT_SPELL
073263
- 	curwin->w_p_spell = FALSE;	/* No spell checking */
073263
- #endif
073263
- 
073263
  #ifdef FEAT_AUTOCMD
073263
! 	buf = curbuf;
073263
  #endif
073263
! 	set_buflisted(FALSE);
073263
      }
073263
      else
073263
      {
073263
- #ifdef FEAT_AUTOCMD
073263
- 	buf = curbuf;
073263
- #endif
073263
  	/* Don't make a buffer listed if it's a help buffer.  Useful when
073263
  	 * using CTRL-O to go back to a help file. */
073263
  	if (!curbuf->b_help)
073263
--- 3532,3546 ----
073263
  	oldbuf = (flags & ECMD_OLDBUF);
073263
      }
073263
  
073263
  #ifdef FEAT_AUTOCMD
073263
!     buf = curbuf;
073263
  #endif
073263
!     if ((flags & ECMD_SET_HELP) || keep_help_flag)
073263
!     {
073263
! 	prepare_help_buffer();
073263
      }
073263
      else
073263
      {
073263
  	/* Don't make a buffer listed if it's a help buffer.  Useful when
073263
  	 * using CTRL-O to go back to a help file. */
073263
  	if (!curbuf->b_help)
073263
***************
073263
*** 6222,6227 ****
073263
--- 6167,6237 ----
073263
  }
073263
  
073263
  /*
073263
+  * Called when starting to edit a buffer for a help file.
073263
+  */
073263
+     static void
073263
+ prepare_help_buffer()
073263
+ {
073263
+     char_u	*p;
073263
+ 
073263
+     curbuf->b_help = TRUE;
073263
+ #ifdef FEAT_QUICKFIX
073263
+     set_string_option_direct((char_u *)"buftype", -1,
073263
+ 				     (char_u *)"help", OPT_FREE|OPT_LOCAL, 0);
073263
+ #endif
073263
+ 
073263
+     /*
073263
+      * Always set these options after jumping to a help tag, because the
073263
+      * user may have an autocommand that gets in the way.
073263
+      * Accept all ASCII chars for keywords, except ' ', '*', '"', '|', and
073263
+      * latin1 word characters (for translated help files).
073263
+      * Only set it when needed, buf_init_chartab() is some work.
073263
+      */
073263
+     p =
073263
+ #ifdef EBCDIC
073263
+ 	    (char_u *)"65-255,^*,^|,^\"";
073263
+ #else
073263
+ 	    (char_u *)"!-~,^*,^|,^\",192-255";
073263
+ #endif
073263
+     if (STRCMP(curbuf->b_p_isk, p) != 0)
073263
+     {
073263
+ 	set_string_option_direct((char_u *)"isk", -1, p, OPT_FREE|OPT_LOCAL, 0);
073263
+ 	check_buf_options(curbuf);
073263
+ 	(void)buf_init_chartab(curbuf, FALSE);
073263
+     }
073263
+ 
073263
+     /* Don't use the global foldmethod.*/
073263
+     set_string_option_direct((char_u *)"fdm", -1, (char_u *)"manual",
073263
+ 						       OPT_FREE|OPT_LOCAL, 0);
073263
+ 
073263
+     curbuf->b_p_ts = 8;		/* 'tabstop' is 8 */
073263
+     curwin->w_p_list = FALSE;	/* no list mode */
073263
+ 
073263
+     curbuf->b_p_ma = FALSE;		/* not modifiable */
073263
+     curbuf->b_p_bin = FALSE;	/* reset 'bin' before reading file */
073263
+     curwin->w_p_nu = 0;		/* no line numbers */
073263
+     curwin->w_p_rnu = 0;		/* no relative line numbers */
073263
+     RESET_BINDING(curwin);		/* no scroll or cursor binding */
073263
+ #ifdef FEAT_ARABIC
073263
+     curwin->w_p_arab = FALSE;	/* no arabic mode */
073263
+ #endif
073263
+ #ifdef FEAT_RIGHTLEFT
073263
+     curwin->w_p_rl  = FALSE;	/* help window is left-to-right */
073263
+ #endif
073263
+ #ifdef FEAT_FOLDING
073263
+     curwin->w_p_fen = FALSE;	/* No folding in the help window */
073263
+ #endif
073263
+ #ifdef FEAT_DIFF
073263
+     curwin->w_p_diff = FALSE;	/* No 'diff' */
073263
+ #endif
073263
+ #ifdef FEAT_SPELL
073263
+     curwin->w_p_spell = FALSE;	/* No spell checking */
073263
+ #endif
073263
+ 
073263
+     set_buflisted(FALSE);
073263
+ }
073263
+ 
073263
+ /*
073263
   * After reading a help file: May cleanup a help buffer when syntax
073263
   * highlighting is not used.
073263
   */
073263
*** ../vim-7.4.514/src/version.c	2014-11-12 18:59:17.602000656 +0100
073263
--- src/version.c	2014-11-12 19:27:25.471182666 +0100
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     515,
073263
  /**/
073263
073263
-- 
073263
If "R" is Reverse, how come "D" is FORWARD?
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///