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