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