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