Karsten Hopp 64824c
To: vim-dev@vim.org
Karsten Hopp 64824c
Subject: Patch 7.0.060
Karsten Hopp 64824c
Fcc: outbox
Karsten Hopp 64824c
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 64824c
Mime-Version: 1.0
Karsten Hopp 64824c
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 64824c
Content-Transfer-Encoding: 8bit
Karsten Hopp 64824c
------------
Karsten Hopp 64824c
Karsten Hopp 64824c
Patch 7.0.060 (after 7.0.51)
Karsten Hopp 64824c
Problem:    Code for temporarily switching to another buffer is duplicated in
Karsten Hopp 64824c
	    quite a few places.
Karsten Hopp 64824c
Solution:   Use aucmd_prepbuf() and aucmd_restbuf() also when FEAT_AUTOCMD is
Karsten Hopp 64824c
	    not defined.
Karsten Hopp 64824c
Files:	    src/buffer.c, src/eval.c, src/fileio.c, src/if_ruby.c,
Karsten Hopp 64824c
	    src/if_perl.xs, src/quickfix.c, src/structs.h
Karsten Hopp 64824c
Karsten Hopp 64824c
Karsten Hopp 64824c
*** ../vim-7.0.059/src/buffer.c	Thu Apr 27 01:49:30 2006
Karsten Hopp 64824c
--- src/buffer.c	Wed Aug 16 14:36:17 2006
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 5420,5430 ****
Karsten Hopp 64824c
      buf_T	*newbuf;
Karsten Hopp 64824c
      int		differ = TRUE;
Karsten Hopp 64824c
      linenr_T	lnum;
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      aco_save_T	aco;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     buf_T	*old_curbuf = curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
      exarg_T	ea;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      /* Allocate a buffer without putting it in the buffer list. */
Karsten Hopp 64824c
--- 5420,5426 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 5439,5451 ****
Karsten Hopp 64824c
  	return TRUE;
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      /* set curwin/curbuf to buf and save a few things */
Karsten Hopp 64824c
      aucmd_prepbuf(&aco, newbuf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     curbuf = newbuf;
Karsten Hopp 64824c
-     curwin->w_buffer = newbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      if (ml_open(curbuf) == OK
Karsten Hopp 64824c
  	    && readfile(buf->b_ffname, buf->b_fname,
Karsten Hopp 64824c
--- 5435,5442 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 5466,5478 ****
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
      vim_free(ea.cmd);
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      /* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
      aucmd_restbuf(&aco;;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     curbuf = old_curbuf;
Karsten Hopp 64824c
-     curwin->w_buffer = old_curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      if (curbuf != newbuf)	/* safety check */
Karsten Hopp 64824c
  	wipe_buffer(newbuf, FALSE);
Karsten Hopp 64824c
--- 5457,5464 ----
Karsten Hopp 64824c
*** ../vim-7.0.059/src/eval.c	Sun Jul 23 22:07:55 2006
Karsten Hopp 64824c
--- src/eval.c	Wed Aug 16 14:38:32 2006
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 14184,14194 ****
Karsten Hopp 64824c
      typval_T	*rettv;
Karsten Hopp 64824c
  {
Karsten Hopp 64824c
      buf_T	*buf;
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      aco_save_T	aco;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     buf_T	*save_curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
      char_u	*varname, *bufvarname;
Karsten Hopp 64824c
      typval_T	*varp;
Karsten Hopp 64824c
      char_u	nbuf[NUMBUFLEN];
Karsten Hopp 64824c
--- 14184,14190 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 14205,14216 ****
Karsten Hopp 64824c
      if (buf != NULL && varname != NULL && varp != NULL)
Karsten Hopp 64824c
      {
Karsten Hopp 64824c
  	/* set curbuf to be our buf, temporarily */
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  	aucmd_prepbuf(&aco, buf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 	save_curbuf = curbuf;
Karsten Hopp 64824c
- 	curbuf = buf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  	if (*varname == '&')
Karsten Hopp 64824c
  	{
Karsten Hopp 64824c
--- 14201,14207 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 14237,14247 ****
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  	/* reset notion of buffer */
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  	aucmd_restbuf(&aco;;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 	curbuf = save_curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
  }
Karsten Hopp 64824c
  
Karsten Hopp 64824c
--- 14228,14234 ----
Karsten Hopp 64824c
*** ../vim-7.0.059/src/fileio.c	Sun Apr 30 20:33:48 2006
Karsten Hopp 64824c
--- src/fileio.c	Wed Aug 16 14:39:23 2006
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 6450,6466 ****
Karsten Hopp 64824c
      int		old_ro = buf->b_p_ro;
Karsten Hopp 64824c
      buf_T	*savebuf;
Karsten Hopp 64824c
      int		saved = OK;
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      aco_save_T	aco;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      /* set curwin/curbuf for "buf" and save some things */
Karsten Hopp 64824c
      aucmd_prepbuf(&aco, buf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     buf_T	*save_curbuf = curbuf;
Karsten Hopp 64824c
- 
Karsten Hopp 64824c
-     curbuf = buf;
Karsten Hopp 64824c
-     curwin->w_buffer = buf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      /* We only want to read the text from the file, not reset the syntax
Karsten Hopp 64824c
       * highlighting, clear marks, diff status, etc.  Force the fileformat
Karsten Hopp 64824c
--- 6450,6459 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 6573,6586 ****
Karsten Hopp 64824c
  	    curbuf->b_p_ro |= old_ro;
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      /* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
      aucmd_restbuf(&aco;;
Karsten Hopp 64824c
      /* Careful: autocommands may have made "buf" invalid! */
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     curwin->w_buffer = save_curbuf;
Karsten Hopp 64824c
-     curbuf = save_curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  }
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  /*ARGSUSED*/
Karsten Hopp 64824c
--- 6566,6574 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 8088,8093 ****
Karsten Hopp 64824c
--- 8076,8082 ----
Karsten Hopp 64824c
   * Search a window for the current buffer.  Save the cursor position and
Karsten Hopp 64824c
   * screen offset.
Karsten Hopp 64824c
   * Set "curbuf" and "curwin" to match "buf".
Karsten Hopp 64824c
+  * When FEAT_AUTOCMD is not defined another version is used, see below.
Karsten Hopp 64824c
   */
Karsten Hopp 64824c
      void
Karsten Hopp 64824c
  aucmd_prepbuf(aco, buf)
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 8151,8156 ****
Karsten Hopp 64824c
--- 8140,8146 ----
Karsten Hopp 64824c
  /*
Karsten Hopp 64824c
   * Cleanup after executing autocommands for a (hidden) buffer.
Karsten Hopp 64824c
   * Restore the window as it was (if possible).
Karsten Hopp 64824c
+  * When FEAT_AUTOCMD is not defined another version is used, see below.
Karsten Hopp 64824c
   */
Karsten Hopp 64824c
      void
Karsten Hopp 64824c
  aucmd_restbuf(aco)
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 9063,9069 ****
Karsten Hopp 64824c
--- 9053,9089 ----
Karsten Hopp 64824c
      return retval;
Karsten Hopp 64824c
  }
Karsten Hopp 64824c
  
Karsten Hopp 64824c
+ #else	/* FEAT_AUTOCMD */
Karsten Hopp 64824c
+ 
Karsten Hopp 64824c
+ /*
Karsten Hopp 64824c
+  * Prepare for executing commands for (hidden) buffer "buf".
Karsten Hopp 64824c
+  * This is the non-autocommand version, it simply saves "curbuf" and sets
Karsten Hopp 64824c
+  * "curbuf" and "curwin" to match "buf".
Karsten Hopp 64824c
+  */
Karsten Hopp 64824c
+     void
Karsten Hopp 64824c
+ aucmd_prepbuf(aco, buf)
Karsten Hopp 64824c
+     aco_save_T	*aco;		/* structure to save values in */
Karsten Hopp 64824c
+     buf_T	*buf;		/* new curbuf */
Karsten Hopp 64824c
+ {
Karsten Hopp 64824c
+     aco->save_buf = buf;
Karsten Hopp 64824c
+     curbuf = buf;
Karsten Hopp 64824c
+     curwin->w_buffer = buf;
Karsten Hopp 64824c
+ }
Karsten Hopp 64824c
+ 
Karsten Hopp 64824c
+ /*
Karsten Hopp 64824c
+  * Restore after executing commands for a (hidden) buffer.
Karsten Hopp 64824c
+  * This is the non-autocommand version.
Karsten Hopp 64824c
+  */
Karsten Hopp 64824c
+     void
Karsten Hopp 64824c
+ aucmd_restbuf(aco)
Karsten Hopp 64824c
+     aco_save_T	*aco;		/* structure holding saved values */
Karsten Hopp 64824c
+ {
Karsten Hopp 64824c
+     curbuf = aco->save_buf;
Karsten Hopp 64824c
+     curwin->w_buffer = curbuf;
Karsten Hopp 64824c
+ }
Karsten Hopp 64824c
+ 
Karsten Hopp 64824c
  #endif	/* FEAT_AUTOCMD */
Karsten Hopp 64824c
+ 
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  #if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) || defined(PROTO)
Karsten Hopp 64824c
  /*
Karsten Hopp 64824c
*** ../vim-7.0.059/src/if_ruby.c	Tue Jun 20 21:08:02 2006
Karsten Hopp 64824c
--- src/if_ruby.c	Wed Aug 16 14:41:11 2006
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 644,664 ****
Karsten Hopp 64824c
  static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
Karsten Hopp 64824c
  {
Karsten Hopp 64824c
      char	*line = STR2CSTR(str);
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      aco_save_T	aco;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     buf_T	*save_curbuf = curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL)
Karsten Hopp 64824c
      {
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  	/* set curwin/curbuf for "buf" and save some things */
Karsten Hopp 64824c
  	aucmd_prepbuf(&aco, buf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 	curbuf = buf;
Karsten Hopp 64824c
- 	curwin->w_buffer = buf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  	if (u_savesub(n) == OK) {
Karsten Hopp 64824c
  	    ml_replace(n, (char_u *)line, TRUE);
Karsten Hopp 64824c
--- 644,655 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 668,681 ****
Karsten Hopp 64824c
  #endif
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  	/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  	aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  	/* Careful: autocommands may have made "buf" invalid! */
Karsten Hopp 64824c
! #else
Karsten Hopp 64824c
! 	curwin->w_buffer = save_curbuf;
Karsten Hopp 64824c
! 	curbuf = save_curbuf;
Karsten Hopp 64824c
! #endif
Karsten Hopp 64824c
  	update_curbuf(NOT_VALID);
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
      else
Karsten Hopp 64824c
--- 659,668 ----
Karsten Hopp 64824c
  #endif
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  	/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  	aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  	/* Careful: autocommands may have made "buf" invalid! */
Karsten Hopp 64824c
! 
Karsten Hopp 64824c
  	update_curbuf(NOT_VALID);
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
      else
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 699,719 ****
Karsten Hopp 64824c
  {
Karsten Hopp 64824c
      buf_T	*buf = get_buf(self);
Karsten Hopp 64824c
      long	n = NUM2LONG(num);
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      aco_save_T	aco;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     buf_T	*save_curbuf = curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      if (n > 0 && n <= buf->b_ml.ml_line_count)
Karsten Hopp 64824c
      {
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  	/* set curwin/curbuf for "buf" and save some things */
Karsten Hopp 64824c
  	aucmd_prepbuf(&aco, buf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 	curbuf = buf;
Karsten Hopp 64824c
- 	curwin->w_buffer = buf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  	if (u_savedel(n, 1) == OK) {
Karsten Hopp 64824c
  	    ml_delete(n, 0);
Karsten Hopp 64824c
--- 686,697 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 725,738 ****
Karsten Hopp 64824c
  	    changed();
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  	/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  	aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  	/* Careful: autocommands may have made "buf" invalid! */
Karsten Hopp 64824c
! #else
Karsten Hopp 64824c
! 	curwin->w_buffer = save_curbuf;
Karsten Hopp 64824c
! 	curbuf = save_curbuf;
Karsten Hopp 64824c
! #endif
Karsten Hopp 64824c
  	update_curbuf(NOT_VALID);
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
      else
Karsten Hopp 64824c
--- 703,712 ----
Karsten Hopp 64824c
  	    changed();
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  	/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  	aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  	/* Careful: autocommands may have made "buf" invalid! */
Karsten Hopp 64824c
! 
Karsten Hopp 64824c
  	update_curbuf(NOT_VALID);
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
      else
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 747,767 ****
Karsten Hopp 64824c
      buf_T	*buf = get_buf(self);
Karsten Hopp 64824c
      char	*line = STR2CSTR(str);
Karsten Hopp 64824c
      long	n = NUM2LONG(num);
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      aco_save_T	aco;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     buf_T	*save_curbuf = curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      if (n >= 0 && n <= buf->b_ml.ml_line_count && line != NULL)
Karsten Hopp 64824c
      {
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  	/* set curwin/curbuf for "buf" and save some things */
Karsten Hopp 64824c
  	aucmd_prepbuf(&aco, buf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 	curbuf = buf;
Karsten Hopp 64824c
- 	curwin->w_buffer = buf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  	if (u_inssub(n + 1) == OK) {
Karsten Hopp 64824c
  	    ml_append(n, (char_u *) line, (colnr_T) 0, FALSE);
Karsten Hopp 64824c
--- 721,732 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 773,786 ****
Karsten Hopp 64824c
  	    changed();
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  	/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  	aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  	/* Careful: autocommands may have made "buf" invalid! */
Karsten Hopp 64824c
! #else
Karsten Hopp 64824c
! 	curwin->w_buffer = save_curbuf;
Karsten Hopp 64824c
! 	curbuf = save_curbuf;
Karsten Hopp 64824c
! #endif
Karsten Hopp 64824c
  	update_curbuf(NOT_VALID);
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
      else {
Karsten Hopp 64824c
--- 738,747 ----
Karsten Hopp 64824c
  	    changed();
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  	/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  	aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  	/* Careful: autocommands may have made "buf" invalid! */
Karsten Hopp 64824c
! 
Karsten Hopp 64824c
  	update_curbuf(NOT_VALID);
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
      else {
Karsten Hopp 64824c
*** ../vim-7.0.059/src/if_perl.xs	Wed Aug 16 18:19:41 2006
Karsten Hopp 64824c
--- src/if_perl.xs	Wed Aug 16 14:45:15 2006
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 1068,1097 ****
Karsten Hopp 64824c
  	    line = SvPV(ST(i),PL_na);
Karsten Hopp 64824c
  	    if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL)
Karsten Hopp 64824c
  	    {
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  		aco_save_T	aco;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  		/* set curwin/curbuf for "vimbuf" and save some things */
Karsten Hopp 64824c
  		aucmd_prepbuf(&aco, vimbuf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 		buf_T	*save_curbuf = curbuf;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- 		curbuf = vimbuf;
Karsten Hopp 64824c
- 		curwin->w_buffer = vimbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  		if (u_savesub(lnum) == OK)
Karsten Hopp 64824c
  		{
Karsten Hopp 64824c
  		    ml_replace(lnum, (char_u *)line, TRUE);
Karsten Hopp 64824c
  		    changed_bytes(lnum, 0);
Karsten Hopp 64824c
  		}
Karsten Hopp 64824c
! #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  		/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  		aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  		/* Careful: autocommands may have made "vimbuf" invalid! */
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 		curwin->w_buffer = save_curbuf;
Karsten Hopp 64824c
- 		curbuf = save_curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  	    }
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
--- 1068,1087 ----
Karsten Hopp 64824c
  	    line = SvPV(ST(i),PL_na);
Karsten Hopp 64824c
  	    if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL)
Karsten Hopp 64824c
  	    {
Karsten Hopp 64824c
  		aco_save_T	aco;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  		/* set curwin/curbuf for "vimbuf" and save some things */
Karsten Hopp 64824c
  		aucmd_prepbuf(&aco, vimbuf);
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  		if (u_savesub(lnum) == OK)
Karsten Hopp 64824c
  		{
Karsten Hopp 64824c
  		    ml_replace(lnum, (char_u *)line, TRUE);
Karsten Hopp 64824c
  		    changed_bytes(lnum, 0);
Karsten Hopp 64824c
  		}
Karsten Hopp 64824c
! 
Karsten Hopp 64824c
  		/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  		aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  		/* Careful: autocommands may have made "vimbuf" invalid! */
Karsten Hopp 64824c
  	    }
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 1128,1158 ****
Karsten Hopp 64824c
  	    {
Karsten Hopp 64824c
  		if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count)
Karsten Hopp 64824c
  		{
Karsten Hopp 64824c
- 		    buf_T	*save_curbuf = curbuf;
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  		    aco_save_T	aco;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  		    /* set curwin/curbuf for "vimbuf" and save some things */
Karsten Hopp 64824c
  		    aucmd_prepbuf(&aco, vimbuf);
Karsten Hopp 64824c
! #else
Karsten Hopp 64824c
! 		    curbuf = vimbuf;
Karsten Hopp 64824c
! 		    curwin->w_buffer = vimbuf;
Karsten Hopp 64824c
! #endif
Karsten Hopp 64824c
  		    if (u_savedel(lnum, 1) == OK)
Karsten Hopp 64824c
  		    {
Karsten Hopp 64824c
  			ml_delete(lnum, 0);
Karsten Hopp 64824c
  			deleted_lines_mark(lnum, 1L);
Karsten Hopp 64824c
! 			if (save_curbuf == curbuf)
Karsten Hopp 64824c
  			    check_cursor();
Karsten Hopp 64824c
  		    }
Karsten Hopp 64824c
! #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  		    /* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  		    aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  		    /* Careful: autocommands may have made "vimbuf" invalid! */
Karsten Hopp 64824c
! #else
Karsten Hopp 64824c
! 		    curwin->w_buffer = save_curbuf;
Karsten Hopp 64824c
! 		    curbuf = save_curbuf;
Karsten Hopp 64824c
! #endif
Karsten Hopp 64824c
  		    update_curbuf(VALID);
Karsten Hopp 64824c
  		}
Karsten Hopp 64824c
  	    }
Karsten Hopp 64824c
--- 1118,1140 ----
Karsten Hopp 64824c
  	    {
Karsten Hopp 64824c
  		if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count)
Karsten Hopp 64824c
  		{
Karsten Hopp 64824c
  		    aco_save_T	aco;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  		    /* set curwin/curbuf for "vimbuf" and save some things */
Karsten Hopp 64824c
  		    aucmd_prepbuf(&aco, vimbuf);
Karsten Hopp 64824c
! 
Karsten Hopp 64824c
  		    if (u_savedel(lnum, 1) == OK)
Karsten Hopp 64824c
  		    {
Karsten Hopp 64824c
  			ml_delete(lnum, 0);
Karsten Hopp 64824c
  			deleted_lines_mark(lnum, 1L);
Karsten Hopp 64824c
! 			if (aco.save_buf == curbuf)
Karsten Hopp 64824c
  			    check_cursor();
Karsten Hopp 64824c
  		    }
Karsten Hopp 64824c
! 
Karsten Hopp 64824c
  		    /* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  		    aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  		    /* Careful: autocommands may have made "vimbuf" invalid! */
Karsten Hopp 64824c
! 
Karsten Hopp 64824c
  		    update_curbuf(VALID);
Karsten Hopp 64824c
  		}
Karsten Hopp 64824c
  	    }
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 1179,1208 ****
Karsten Hopp 64824c
  	    line = SvPV(ST(i),PL_na);
Karsten Hopp 64824c
  	    if (lnum >= 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL)
Karsten Hopp 64824c
  	    {
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  		aco_save_T	aco;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  		/* set curwin/curbuf for "vimbuf" and save some things */
Karsten Hopp 64824c
  		aucmd_prepbuf(&aco, vimbuf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 		buf_T	*save_curbuf = curbuf;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- 		curbuf = vimbuf;
Karsten Hopp 64824c
- 		curwin->w_buffer = vimbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  		if (u_inssub(lnum + 1) == OK)
Karsten Hopp 64824c
  		{
Karsten Hopp 64824c
  		    ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE);
Karsten Hopp 64824c
  		    appended_lines_mark(lnum, 1L);
Karsten Hopp 64824c
  		}
Karsten Hopp 64824c
! #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  		/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  		aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  		/* Careful: autocommands may have made "vimbuf" invalid! */
Karsten Hopp 64824c
! #else
Karsten Hopp 64824c
! 		curwin->w_buffer = save_curbuf;
Karsten Hopp 64824c
! 		curbuf = save_curbuf;
Karsten Hopp 64824c
! #endif
Karsten Hopp 64824c
  		update_curbuf(VALID);
Karsten Hopp 64824c
  	    }
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
--- 1161,1181 ----
Karsten Hopp 64824c
  	    line = SvPV(ST(i),PL_na);
Karsten Hopp 64824c
  	    if (lnum >= 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL)
Karsten Hopp 64824c
  	    {
Karsten Hopp 64824c
  		aco_save_T	aco;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  		/* set curwin/curbuf for "vimbuf" and save some things */
Karsten Hopp 64824c
  		aucmd_prepbuf(&aco, vimbuf);
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  		if (u_inssub(lnum + 1) == OK)
Karsten Hopp 64824c
  		{
Karsten Hopp 64824c
  		    ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE);
Karsten Hopp 64824c
  		    appended_lines_mark(lnum, 1L);
Karsten Hopp 64824c
  		}
Karsten Hopp 64824c
! 
Karsten Hopp 64824c
  		/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  		aucmd_restbuf(&aco;;
Karsten Hopp 64824c
  		/* Careful: autocommands may have made "vimbuf" invalid! */
Karsten Hopp 64824c
! 
Karsten Hopp 64824c
  		update_curbuf(VALID);
Karsten Hopp 64824c
  	    }
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
*** ../vim-7.0.059/src/quickfix.c	Tue Jun 20 20:49:42 2006
Karsten Hopp 64824c
--- src/quickfix.c	Wed Aug 16 14:43:06 2006
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 2463,2494 ****
Karsten Hopp 64824c
      qf_info_T	*qi;
Karsten Hopp 64824c
  {
Karsten Hopp 64824c
      buf_T	*buf;
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      aco_save_T	aco;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     buf_T	*save_curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      /* Check if a buffer for the quickfix list exists.  Update it. */
Karsten Hopp 64824c
      buf = qf_find_buf(qi);
Karsten Hopp 64824c
      if (buf != NULL)
Karsten Hopp 64824c
      {
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  	/* set curwin/curbuf to buf and save a few things */
Karsten Hopp 64824c
  	aucmd_prepbuf(&aco, buf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 	save_curbuf = curbuf;
Karsten Hopp 64824c
- 	curbuf = buf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  	qf_fill_buffer(qi);
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
  	/* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
  	aucmd_restbuf(&aco;;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 	curbuf = save_curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  	(void)qf_win_pos_update(qi, 0);
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
--- 2463,2481 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 2977,2986 ****
Karsten Hopp 64824c
  #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
Karsten Hopp 64824c
      char_u	*save_ei = NULL;
Karsten Hopp 64824c
  #endif
Karsten Hopp 64824c
- #ifndef FEAT_AUTOCMD
Karsten Hopp 64824c
-     buf_T	*save_curbuf;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
      aco_save_T	aco;
Karsten Hopp 64824c
      char_u	*au_name =  NULL;
Karsten Hopp 64824c
      int		flags = 0;
Karsten Hopp 64824c
      colnr_T	col;
Karsten Hopp 64824c
--- 2964,2971 ----
Karsten Hopp 64824c
  #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
Karsten Hopp 64824c
      char_u	*save_ei = NULL;
Karsten Hopp 64824c
  #endif
Karsten Hopp 64824c
      aco_save_T	aco;
Karsten Hopp 64824c
+ #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      char_u	*au_name =  NULL;
Karsten Hopp 64824c
      int		flags = 0;
Karsten Hopp 64824c
      colnr_T	col;
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 3201,3224 ****
Karsten Hopp 64824c
  		     * need to be done now, in that buffer.  And the modelines
Karsten Hopp 64824c
  		     * need to be done (again).  But not the window-local
Karsten Hopp 64824c
  		     * options! */
Karsten Hopp 64824c
- #if defined(FEAT_AUTOCMD)
Karsten Hopp 64824c
  		    aucmd_prepbuf(&aco, buf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 		    save_curbuf = curbuf;
Karsten Hopp 64824c
- 		    curbuf = buf;
Karsten Hopp 64824c
- 		    curwin->w_buffer = curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
Karsten Hopp 64824c
  		    apply_autocmds(EVENT_FILETYPE, buf->b_p_ft,
Karsten Hopp 64824c
  						     buf->b_fname, TRUE, buf);
Karsten Hopp 64824c
  #endif
Karsten Hopp 64824c
  		    do_modelines(OPT_NOWIN);
Karsten Hopp 64824c
- #if defined(FEAT_AUTOCMD)
Karsten Hopp 64824c
  		    aucmd_restbuf(&aco;;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
- 		    curbuf = save_curbuf;
Karsten Hopp 64824c
- 		    curwin->w_buffer = curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  		}
Karsten Hopp 64824c
  	    }
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
--- 3186,3198 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 3319,3329 ****
Karsten Hopp 64824c
  {
Karsten Hopp 64824c
      buf_T	*newbuf;
Karsten Hopp 64824c
      int		failed = TRUE;
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      aco_save_T	aco;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     buf_T	*old_curbuf = curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      /* Allocate a buffer without putting it in the buffer list. */
Karsten Hopp 64824c
      newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY);
Karsten Hopp 64824c
--- 3293,3299 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 3333,3345 ****
Karsten Hopp 64824c
      /* Init the options. */
Karsten Hopp 64824c
      buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP);
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      /* set curwin/curbuf to buf and save a few things */
Karsten Hopp 64824c
      aucmd_prepbuf(&aco, newbuf);
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     curbuf = newbuf;
Karsten Hopp 64824c
-     curwin->w_buffer = newbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      /* Need to set the filename for autocommands. */
Karsten Hopp 64824c
      (void)setfname(curbuf, fname, NULL, FALSE);
Karsten Hopp 64824c
--- 3303,3310 ----
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 3370,3382 ****
Karsten Hopp 64824c
  	}
Karsten Hopp 64824c
      }
Karsten Hopp 64824c
  
Karsten Hopp 64824c
- #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      /* restore curwin/curbuf and a few other things */
Karsten Hopp 64824c
      aucmd_restbuf(&aco;;
Karsten Hopp 64824c
- #else
Karsten Hopp 64824c
-     curbuf = old_curbuf;
Karsten Hopp 64824c
-     curwin->w_buffer = old_curbuf;
Karsten Hopp 64824c
- #endif
Karsten Hopp 64824c
  
Karsten Hopp 64824c
      if (!buf_valid(newbuf))
Karsten Hopp 64824c
  	return NULL;
Karsten Hopp 64824c
--- 3335,3342 ----
Karsten Hopp 64824c
*** ../vim-7.0.059/src/structs.h	Sun Apr  9 23:52:16 2006
Karsten Hopp 64824c
--- src/structs.h	Wed Aug 16 19:30:48 2006
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 2213,2230 ****
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  /*
Karsten Hopp 64824c
   * Struct to save values in before executing autocommands for a buffer that is
Karsten Hopp 64824c
!  * not the current buffer.
Karsten Hopp 64824c
   */
Karsten Hopp 64824c
  typedef struct
Karsten Hopp 64824c
  {
Karsten Hopp 64824c
      buf_T	*save_buf;	/* saved curbuf */
Karsten Hopp 64824c
      buf_T	*new_curbuf;	/* buffer to be used */
Karsten Hopp 64824c
      win_T	*save_curwin;	/* saved curwin, NULL if it didn't change */
Karsten Hopp 64824c
      win_T	*new_curwin;	/* new curwin if save_curwin != NULL */
Karsten Hopp 64824c
      pos_T	save_cursor;	/* saved cursor pos of save_curwin */
Karsten Hopp 64824c
      linenr_T	save_topline;	/* saved topline of save_curwin */
Karsten Hopp 64824c
! #ifdef FEAT_DIFF
Karsten Hopp 64824c
      int		save_topfill;	/* saved topfill of save_curwin */
Karsten Hopp 64824c
  #endif
Karsten Hopp 64824c
  } aco_save_T;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
--- 2213,2232 ----
Karsten Hopp 64824c
  
Karsten Hopp 64824c
  /*
Karsten Hopp 64824c
   * Struct to save values in before executing autocommands for a buffer that is
Karsten Hopp 64824c
!  * not the current buffer.  Without FEAT_AUTOCMD only "curbuf" is remembered.
Karsten Hopp 64824c
   */
Karsten Hopp 64824c
  typedef struct
Karsten Hopp 64824c
  {
Karsten Hopp 64824c
      buf_T	*save_buf;	/* saved curbuf */
Karsten Hopp 64824c
+ #ifdef FEAT_AUTOCMD
Karsten Hopp 64824c
      buf_T	*new_curbuf;	/* buffer to be used */
Karsten Hopp 64824c
      win_T	*save_curwin;	/* saved curwin, NULL if it didn't change */
Karsten Hopp 64824c
      win_T	*new_curwin;	/* new curwin if save_curwin != NULL */
Karsten Hopp 64824c
      pos_T	save_cursor;	/* saved cursor pos of save_curwin */
Karsten Hopp 64824c
      linenr_T	save_topline;	/* saved topline of save_curwin */
Karsten Hopp 64824c
! # ifdef FEAT_DIFF
Karsten Hopp 64824c
      int		save_topfill;	/* saved topfill of save_curwin */
Karsten Hopp 64824c
+ # endif
Karsten Hopp 64824c
  #endif
Karsten Hopp 64824c
  } aco_save_T;
Karsten Hopp 64824c
  
Karsten Hopp 64824c
*** ../vim-7.0.059/src/version.c	Wed Aug 16 18:19:41 2006
Karsten Hopp 64824c
--- src/version.c	Wed Aug 16 19:31:01 2006
Karsten Hopp 64824c
***************
Karsten Hopp 64824c
*** 668,669 ****
Karsten Hopp 64824c
--- 668,671 ----
Karsten Hopp 64824c
  {   /* Add new patch number below this line */
Karsten Hopp 64824c
+ /**/
Karsten Hopp 64824c
+     60,
Karsten Hopp 64824c
  /**/
Karsten Hopp 64824c
Karsten Hopp 64824c
-- 
Karsten Hopp 64824c
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 64824c
164. You got out to buy software, instead of going out for a beer.
Karsten Hopp 64824c
Karsten Hopp 64824c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 64824c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 64824c
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 64824c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///