Karsten Hopp b8fc4b
To: vim_dev@googlegroups.com
Karsten Hopp b8fc4b
Subject: Patch 7.3.753
Karsten Hopp b8fc4b
Fcc: outbox
Karsten Hopp b8fc4b
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp b8fc4b
Mime-Version: 1.0
Karsten Hopp b8fc4b
Content-Type: text/plain; charset=UTF-8
Karsten Hopp b8fc4b
Content-Transfer-Encoding: 8bit
Karsten Hopp b8fc4b
------------
Karsten Hopp b8fc4b
Karsten Hopp b8fc4b
Patch 7.3.753
Karsten Hopp b8fc4b
Problem:    When there is a QuitPre autocommand using ":q" twice does not work
Karsten Hopp b8fc4b
	    for exiting when there are more files to edit.
Karsten Hopp b8fc4b
Solution:   Do not decrement quitmore in an autocommand. (Techlive Zheng)
Karsten Hopp b8fc4b
Files:	    src/ex_docmd.c, src/fileio.c, src/proto/fileio.pro
Karsten Hopp b8fc4b
Karsten Hopp b8fc4b
Karsten Hopp b8fc4b
*** ../vim-7.3.752/src/ex_docmd.c	2012-11-28 23:03:02.000000000 +0100
Karsten Hopp b8fc4b
--- src/ex_docmd.c	2012-12-05 19:07:01.000000000 +0100
Karsten Hopp b8fc4b
***************
Karsten Hopp b8fc4b
*** 1729,1739 ****
Karsten Hopp b8fc4b
      ++ex_nesting_level;
Karsten Hopp b8fc4b
  #endif
Karsten Hopp b8fc4b
  
Karsten Hopp b8fc4b
! 	/* when not editing the last file :q has to be typed twice */
Karsten Hopp b8fc4b
      if (quitmore
Karsten Hopp b8fc4b
  #ifdef FEAT_EVAL
Karsten Hopp b8fc4b
  	    /* avoid that a function call in 'statusline' does this */
Karsten Hopp b8fc4b
  	    && !getline_equal(fgetline, cookie, get_func_line)
Karsten Hopp b8fc4b
  #endif
Karsten Hopp b8fc4b
  	    )
Karsten Hopp b8fc4b
  	--quitmore;
Karsten Hopp b8fc4b
--- 1729,1741 ----
Karsten Hopp b8fc4b
      ++ex_nesting_level;
Karsten Hopp b8fc4b
  #endif
Karsten Hopp b8fc4b
  
Karsten Hopp b8fc4b
!     /* When the last file has not been edited :q has to be typed twice. */
Karsten Hopp b8fc4b
      if (quitmore
Karsten Hopp b8fc4b
  #ifdef FEAT_EVAL
Karsten Hopp b8fc4b
  	    /* avoid that a function call in 'statusline' does this */
Karsten Hopp b8fc4b
  	    && !getline_equal(fgetline, cookie, get_func_line)
Karsten Hopp b8fc4b
+ 	    /* avoid that an autocommand, e.g. QuitPre, does this */
Karsten Hopp b8fc4b
+ 	    && !getline_equal(fgetline, cookie, getnextac)
Karsten Hopp b8fc4b
  #endif
Karsten Hopp b8fc4b
  	    )
Karsten Hopp b8fc4b
  	--quitmore;
Karsten Hopp b8fc4b
*** ../vim-7.3.752/src/fileio.c	2012-08-29 18:50:50.000000000 +0200
Karsten Hopp b8fc4b
--- src/fileio.c	2012-12-05 19:08:17.000000000 +0100
Karsten Hopp b8fc4b
***************
Karsten Hopp b8fc4b
*** 7774,7780 ****
Karsten Hopp b8fc4b
  static int event_ignored __ARGS((event_T event));
Karsten Hopp b8fc4b
  static int au_get_grouparg __ARGS((char_u **argp));
Karsten Hopp b8fc4b
  static int do_autocmd_event __ARGS((event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group));
Karsten Hopp b8fc4b
- static char_u *getnextac __ARGS((int c, void *cookie, int indent));
Karsten Hopp b8fc4b
  static int apply_autocmds_group __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap));
Karsten Hopp b8fc4b
  static void auto_next_pat __ARGS((AutoPatCmd *apc, int stop_at_last));
Karsten Hopp b8fc4b
  
Karsten Hopp b8fc4b
--- 7774,7779 ----
Karsten Hopp b8fc4b
***************
Karsten Hopp b8fc4b
*** 9613,9619 ****
Karsten Hopp b8fc4b
   * Called by do_cmdline() to get the next line for ":if".
Karsten Hopp b8fc4b
   * Returns allocated string, or NULL for end of autocommands.
Karsten Hopp b8fc4b
   */
Karsten Hopp b8fc4b
!     static char_u *
Karsten Hopp b8fc4b
  getnextac(c, cookie, indent)
Karsten Hopp b8fc4b
      int	    c UNUSED;
Karsten Hopp b8fc4b
      void    *cookie;
Karsten Hopp b8fc4b
--- 9612,9618 ----
Karsten Hopp b8fc4b
   * Called by do_cmdline() to get the next line for ":if".
Karsten Hopp b8fc4b
   * Returns allocated string, or NULL for end of autocommands.
Karsten Hopp b8fc4b
   */
Karsten Hopp b8fc4b
!     char_u *
Karsten Hopp b8fc4b
  getnextac(c, cookie, indent)
Karsten Hopp b8fc4b
      int	    c UNUSED;
Karsten Hopp b8fc4b
      void    *cookie;
Karsten Hopp b8fc4b
*** ../vim-7.3.752/src/proto/fileio.pro	2012-02-29 18:22:03.000000000 +0100
Karsten Hopp b8fc4b
--- src/proto/fileio.pro	2012-12-05 19:08:24.000000000 +0100
Karsten Hopp b8fc4b
***************
Karsten Hopp b8fc4b
*** 47,52 ****
Karsten Hopp b8fc4b
--- 47,53 ----
Karsten Hopp b8fc4b
  int has_insertcharpre __ARGS((void));
Karsten Hopp b8fc4b
  void block_autocmds __ARGS((void));
Karsten Hopp b8fc4b
  void unblock_autocmds __ARGS((void));
Karsten Hopp b8fc4b
+ char_u *getnextac __ARGS((int c, void *cookie, int indent));
Karsten Hopp b8fc4b
  int has_autocmd __ARGS((event_T event, char_u *sfname, buf_T *buf));
Karsten Hopp b8fc4b
  char_u *get_augroup_name __ARGS((expand_T *xp, int idx));
Karsten Hopp b8fc4b
  char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd));
Karsten Hopp b8fc4b
*** ../vim-7.3.752/src/version.c	2012-12-05 19:00:03.000000000 +0100
Karsten Hopp b8fc4b
--- src/version.c	2012-12-05 19:08:34.000000000 +0100
Karsten Hopp b8fc4b
***************
Karsten Hopp b8fc4b
*** 727,728 ****
Karsten Hopp b8fc4b
--- 727,730 ----
Karsten Hopp b8fc4b
  {   /* Add new patch number below this line */
Karsten Hopp b8fc4b
+ /**/
Karsten Hopp b8fc4b
+     753,
Karsten Hopp b8fc4b
  /**/
Karsten Hopp b8fc4b
Karsten Hopp b8fc4b
-- 
Karsten Hopp b8fc4b
Laughing helps. It's like jogging on the inside.
Karsten Hopp b8fc4b
Karsten Hopp b8fc4b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp b8fc4b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp b8fc4b
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp b8fc4b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///