Karsten Hopp fb5c42
To: vim-dev@vim.org
Karsten Hopp fb5c42
Subject: patch 7.1.006
Karsten Hopp fb5c42
Fcc: outbox
Karsten Hopp fb5c42
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp fb5c42
Mime-Version: 1.0
Karsten Hopp fb5c42
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp fb5c42
Content-Transfer-Encoding: 8bit
Karsten Hopp fb5c42
------------
Karsten Hopp fb5c42
Karsten Hopp fb5c42
Patch 7.1.006
Karsten Hopp fb5c42
Problem:    Resetting 'modified' in a StdinReadPost autocommand doesn't work.
Karsten Hopp fb5c42
Solution:   Set 'modified' before the autocommands instead of after it.
Karsten Hopp fb5c42
Files:	    src/buffer.c
Karsten Hopp fb5c42
Karsten Hopp fb5c42
Karsten Hopp fb5c42
*** ../vim-7.1.005/src/buffer.c	Thu May 10 18:43:46 2007
Karsten Hopp fb5c42
--- src/buffer.c	Fri Jun  8 20:59:04 2007
Karsten Hopp fb5c42
***************
Karsten Hopp fb5c42
*** 171,176 ****
Karsten Hopp fb5c42
--- 171,183 ----
Karsten Hopp fb5c42
  	    /* Put the cursor on the first line. */
Karsten Hopp fb5c42
  	    curwin->w_cursor.lnum = 1;
Karsten Hopp fb5c42
  	    curwin->w_cursor.col = 0;
Karsten Hopp fb5c42
+ 
Karsten Hopp fb5c42
+ 	    /* Set or reset 'modified' before executing autocommands, so that
Karsten Hopp fb5c42
+ 	     * it can be changed there. */
Karsten Hopp fb5c42
+ 	    if (!readonlymode && !bufempty())
Karsten Hopp fb5c42
+ 		changed();
Karsten Hopp fb5c42
+ 	    else if (retval != FAIL)
Karsten Hopp fb5c42
+ 		unchanged(curbuf, FALSE);
Karsten Hopp fb5c42
  #ifdef FEAT_AUTOCMD
Karsten Hopp fb5c42
  # ifdef FEAT_EVAL
Karsten Hopp fb5c42
  	    apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
Karsten Hopp fb5c42
***************
Karsten Hopp fb5c42
*** 194,209 ****
Karsten Hopp fb5c42
      /* When reading stdin, the buffer contents always needs writing, so set
Karsten Hopp fb5c42
       * the changed flag.  Unless in readonly mode: "ls | gview -".
Karsten Hopp fb5c42
       * When interrupted and 'cpoptions' contains 'i' set changed flag. */
Karsten Hopp fb5c42
!     if ((read_stdin && !readonlymode && !bufempty())
Karsten Hopp fb5c42
  #ifdef FEAT_AUTOCMD
Karsten Hopp fb5c42
  		|| modified_was_set	/* ":set modified" used in autocmd */
Karsten Hopp fb5c42
  # ifdef FEAT_EVAL
Karsten Hopp fb5c42
  		|| (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
Karsten Hopp fb5c42
  # endif
Karsten Hopp fb5c42
  #endif
Karsten Hopp fb5c42
! 		|| (got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL))
Karsten Hopp fb5c42
  	changed();
Karsten Hopp fb5c42
!     else if (retval != FAIL)
Karsten Hopp fb5c42
  	unchanged(curbuf, FALSE);
Karsten Hopp fb5c42
      save_file_ff(curbuf);		/* keep this fileformat */
Karsten Hopp fb5c42
  
Karsten Hopp fb5c42
--- 201,216 ----
Karsten Hopp fb5c42
      /* When reading stdin, the buffer contents always needs writing, so set
Karsten Hopp fb5c42
       * the changed flag.  Unless in readonly mode: "ls | gview -".
Karsten Hopp fb5c42
       * When interrupted and 'cpoptions' contains 'i' set changed flag. */
Karsten Hopp fb5c42
!     if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
Karsten Hopp fb5c42
  #ifdef FEAT_AUTOCMD
Karsten Hopp fb5c42
  		|| modified_was_set	/* ":set modified" used in autocmd */
Karsten Hopp fb5c42
  # ifdef FEAT_EVAL
Karsten Hopp fb5c42
  		|| (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
Karsten Hopp fb5c42
  # endif
Karsten Hopp fb5c42
  #endif
Karsten Hopp fb5c42
!        )
Karsten Hopp fb5c42
  	changed();
Karsten Hopp fb5c42
!     else if (retval != FAIL && !read_stdin)
Karsten Hopp fb5c42
  	unchanged(curbuf, FALSE);
Karsten Hopp fb5c42
      save_file_ff(curbuf);		/* keep this fileformat */
Karsten Hopp fb5c42
  
Karsten Hopp fb5c42
*** ../vim-7.1.005/src/version.c	Tue Jun 19 12:58:55 2007
Karsten Hopp fb5c42
--- src/version.c	Tue Jun 19 15:37:53 2007
Karsten Hopp fb5c42
***************
Karsten Hopp fb5c42
*** 668,669 ****
Karsten Hopp fb5c42
--- 668,671 ----
Karsten Hopp fb5c42
  {   /* Add new patch number below this line */
Karsten Hopp fb5c42
+ /**/
Karsten Hopp fb5c42
+     6,
Karsten Hopp fb5c42
  /**/
Karsten Hopp fb5c42
Karsten Hopp fb5c42
-- 
Karsten Hopp fb5c42
If I tell you "you have a beautiful body", would you hold it against me?
Karsten Hopp fb5c42
Karsten Hopp fb5c42
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp fb5c42
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp fb5c42
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp fb5c42
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///