To: vim_dev@googlegroups.com Subject: Patch 8.0.1564 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1564 Problem: Too many #ifdefs. Solution: Graduate the +autocmd feature. Takes away 450 #ifdefs and increases code size of tiny Vim by only 40 Kbyte. Files: src/buffer.c, src/diff.c, src/edit.c, src/eval.c, src/evalfunc.c, src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/fileio.c, src/getchar.c, src/globals.h, src/gui.c, src/if_cscope.c, src/if_xcmdsrv.c, src/main.c, src/mbyte.c, src/memline.c, src/menu.c, src/misc1.c, src/gui_mac.c, src/misc2.c, src/move.c, src/netbeans.c, src/normal.c, src/ops.c, src/option.c, src/option.h, src/feature.h, src/vim.h, src/os_amiga.c, src/os_mswin.c, src/os_unix.c, src/os_win32.c, src/quickfix.c, src/screen.c, src/search.c, src/spell.c, src/structs.h, src/syntax.c, src/tag.c, src/term.c, src/terminal.c, src/ui.c, src/undo.c, src/userfunc.c, src/version.c, src/window.c *** ../vim-8.0.1563/src/buffer.c 2018-02-19 23:09:57.385619337 +0100 --- src/buffer.c 2018-03-04 15:27:11.361533238 +0100 *************** *** 63,71 **** static char *msg_loclist = N_("[Location List]"); static char *msg_qflist = N_("[Quickfix List]"); #endif - #ifdef FEAT_AUTOCMD static char *e_auabort = N_("E855: Autocommands caused command to abort"); - #endif /* Number of times free_buffer() was called. */ static int buf_free_count = 0; --- 63,69 ---- *************** *** 116,132 **** else if (retval == OK) unchanged(curbuf, FALSE); - #ifdef FEAT_AUTOCMD if (retval == OK) { ! # ifdef FEAT_EVAL apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE, ! curbuf, &retval); ! # else apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf); - # endif - } #endif } return retval; } --- 114,128 ---- else if (retval == OK) unchanged(curbuf, FALSE); if (retval == OK) { ! #ifdef FEAT_EVAL apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE, ! curbuf, &retval); ! #else apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf); #endif + } } return retval; } *************** *** 143,151 **** int flags) /* extra flags for readfile() */ { int retval = OK; - #ifdef FEAT_AUTOCMD bufref_T old_curbuf; - #endif #ifdef FEAT_SYN_HL long old_tw = curbuf->b_p_tw; #endif --- 139,145 ---- *************** *** 188,199 **** return FAIL; } - #ifdef FEAT_AUTOCMD /* The autocommands in readfile() may change the buffer, but only AFTER * reading the file. */ set_bufref(&old_curbuf, curbuf); modified_was_set = FALSE; - #endif /* mark cursor position as being invalid */ curwin->w_valid = 0; --- 182,191 ---- *************** *** 289,299 **** * the changed flag. Unless in readonly mode: "ls | gview -". * When interrupted and 'cpoptions' contains 'i' set changed flag. */ if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) - #ifdef FEAT_AUTOCMD || modified_was_set /* ":set modified" used in autocmd */ ! # ifdef FEAT_EVAL || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL) - # endif #endif ) changed(); --- 281,289 ---- * the changed flag. Unless in readonly mode: "ls | gview -". * When interrupted and 'cpoptions' contains 'i' set changed flag. */ if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) || modified_was_set /* ":set modified" used in autocmd */ ! #ifdef FEAT_EVAL || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL) #endif ) changed(); *************** *** 315,339 **** foldUpdateAll(curwin); #endif - #ifdef FEAT_AUTOCMD /* need to set w_topline, unless some autocommand already did that. */ if (!(curwin->w_valid & VALID_TOPLINE)) { curwin->w_topline = 1; ! # ifdef FEAT_DIFF curwin->w_topfill = 0; ! # endif } ! # ifdef FEAT_EVAL apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval); ! # else apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); - # endif #endif if (retval == OK) { - #ifdef FEAT_AUTOCMD /* * The autocommands may have changed the current buffer. Apply the * modelines to the correct buffer, if it still exists and is loaded. --- 305,326 ---- foldUpdateAll(curwin); #endif /* need to set w_topline, unless some autocommand already did that. */ if (!(curwin->w_valid & VALID_TOPLINE)) { curwin->w_topline = 1; ! #ifdef FEAT_DIFF curwin->w_topfill = 0; ! #endif } ! #ifdef FEAT_EVAL apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval); ! #else apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); #endif if (retval == OK) { /* * The autocommands may have changed the current buffer. Apply the * modelines to the correct buffer, if it still exists and is loaded. *************** *** 344,365 **** /* Go to the buffer that was opened. */ aucmd_prepbuf(&aco, old_curbuf.br_buf); - #endif do_modelines(0); curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED); ! #ifdef FEAT_AUTOCMD ! # ifdef FEAT_EVAL apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf, ! &retval); ! # else apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); ! # endif /* restore curwin/curbuf and a few other things */ aucmd_restbuf(&aco); } - #endif } return retval; --- 331,349 ---- /* Go to the buffer that was opened. */ aucmd_prepbuf(&aco, old_curbuf.br_buf); do_modelines(0); curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED); ! #ifdef FEAT_EVAL apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf, ! &retval); ! #else apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); ! #endif /* restore curwin/curbuf and a few other things */ aucmd_restbuf(&aco); } } return retval; *************** *** 454,467 **** int action, int abort_if_last UNUSED) { - #ifdef FEAT_AUTOCMD int is_curbuf; int nwindows; bufref_T bufref; int is_curwin = (curwin != NULL && curwin->w_buffer == buf); win_T *the_curwin = curwin; tabpage_T *the_curtab = curtab; - #endif int unload_buf = (action != 0); int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE); int wipe_buf = (action == DOBUF_WIPE); --- 438,449 ---- *************** *** 510,516 **** } #endif - #ifdef FEAT_AUTOCMD /* Disallow deleting the buffer when it is locked (already being closed or * halfway a command that relies on it). Unloading is allowed. */ if (buf->b_locked > 0 && (del_buf || wipe_buf)) --- 492,497 ---- *************** *** 518,524 **** EMSG(_("E937: Attempt to delete a buffer that is in use")); return; } - #endif /* check no autocommands closed the window */ if (win != NULL && win_valid_any_tab(win)) --- 499,504 ---- *************** *** 534,540 **** win->w_cursor.col, TRUE); } - #ifdef FEAT_AUTOCMD set_bufref(&bufref, buf); /* When the buffer is no longer in a window, trigger BufWinLeave */ --- 514,519 ---- *************** *** 570,579 **** /* Autocommands made this the only window. */ goto aucmd_abort; } ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; ! # endif } /* If the buffer was in curwin and the window has changed, go back to that --- 549,558 ---- /* Autocommands made this the only window. */ goto aucmd_abort; } ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; ! #endif } /* If the buffer was in curwin and the window has changed, go back to that *************** *** 587,593 **** } nwindows = buf->b_nwindows; - #endif /* decrease the link count from windows (unless not in any window) */ if (buf->b_nwindows > 0) --- 566,571 ---- *************** *** 620,642 **** * Free all things allocated for this buffer. * Also calls the "BufDelete" autocommands when del_buf is TRUE. */ - #ifdef FEAT_AUTOCMD /* Remember if we are closing the current buffer. Restore the number of * windows, so that autocommands in buf_freeall() don't get confused. */ is_curbuf = (buf == curbuf); buf->b_nwindows = nwindows; - #endif buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); - #ifdef FEAT_AUTOCMD /* Autocommands may have deleted the buffer. */ if (!bufref_valid(&bufref)) return; ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; ! # endif /* * It's possible that autocommands change curbuf to the one being deleted. --- 598,617 ---- * Free all things allocated for this buffer. * Also calls the "BufDelete" autocommands when del_buf is TRUE. */ /* Remember if we are closing the current buffer. Restore the number of * windows, so that autocommands in buf_freeall() don't get confused. */ is_curbuf = (buf == curbuf); buf->b_nwindows = nwindows; buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); /* Autocommands may have deleted the buffer. */ if (!bufref_valid(&bufref)) return; ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; ! #endif /* * It's possible that autocommands change curbuf to the one being deleted. *************** *** 655,661 **** * Decrement the count for the close we do here. */ if (buf->b_nwindows > 0) --buf->b_nwindows; - #endif /* * Remove the buffer from the list. --- 630,635 ---- *************** *** 732,738 **** void buf_freeall(buf_T *buf, int flags) { - #ifdef FEAT_AUTOCMD int is_curbuf = (buf == curbuf); bufref_T bufref; int is_curwin = (curwin != NULL && curwin->w_buffer == buf); --- 706,711 ---- *************** *** 778,787 **** unblock_autocmds(); } ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; ! # endif /* * It's possible that autocommands change curbuf to the one being deleted. --- 751,760 ---- unblock_autocmds(); } ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; ! #endif /* * It's possible that autocommands change curbuf to the one being deleted. *************** *** 791,797 **** */ if (buf == curbuf && !is_curbuf) return; - #endif #ifdef FEAT_DIFF diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */ #endif --- 764,769 ---- *************** *** 870,876 **** buf_hashtab_remove(buf); - #ifdef FEAT_AUTOCMD aubuflocal_remove(buf); if (autocmd_busy) --- 842,847 ---- *************** *** 881,887 **** au_pending_free_buf = buf; } else - #endif vim_free(buf); } --- 852,857 ---- *************** *** 994,1000 **** # if defined(HAS_SWAP_EXISTS_ACTION) if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') { ! # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that --- 964,970 ---- # if defined(HAS_SWAP_EXISTS_ACTION) if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') { ! # if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that *************** *** 1007,1013 **** swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; ! # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); --- 977,983 ---- swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; ! # if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); *************** *** 1027,1043 **** void handle_swap_exists(bufref_T *old_curbuf) { ! # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) cleanup_T cs; # endif ! #ifdef FEAT_SYN_HL long old_tw = curbuf->b_p_tw; ! #endif buf_T *buf; if (swap_exists_action == SEA_QUIT) { ! # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a buffer. */ enter_cleanup(&cs); --- 997,1013 ---- void handle_swap_exists(bufref_T *old_curbuf) { ! # if defined(FEAT_EVAL) cleanup_T cs; # endif ! # ifdef FEAT_SYN_HL long old_tw = curbuf->b_p_tw; ! # endif buf_T *buf; if (swap_exists_action == SEA_QUIT) { ! # if defined(FEAT_EVAL) /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a buffer. */ enter_cleanup(&cs); *************** *** 1057,1070 **** if (buf != NULL) { enter_buffer(buf); ! #ifdef FEAT_SYN_HL if (old_tw != curbuf->b_p_tw) check_colorcolumn(curwin); ! #endif } /* If "old_curbuf" is NULL we are in big trouble here... */ ! # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); --- 1027,1040 ---- if (buf != NULL) { enter_buffer(buf); ! # ifdef FEAT_SYN_HL if (old_tw != curbuf->b_p_tw) check_colorcolumn(curwin); ! # endif } /* If "old_curbuf" is NULL we are in big trouble here... */ ! # if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); *************** *** 1072,1078 **** } else if (swap_exists_action == SEA_RECOVER) { ! # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a buffer. */ enter_cleanup(&cs); --- 1042,1048 ---- } else if (swap_exists_action == SEA_RECOVER) { ! # if defined(FEAT_EVAL) /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a buffer. */ enter_cleanup(&cs); *************** *** 1085,1091 **** cmdline_row = msg_row; do_modelines(0); ! # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); --- 1055,1061 ---- cmdline_row = msg_row; do_modelines(0); ! # if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); *************** *** 1400,1422 **** if (!forceit && bufIsChanged(buf)) { ! #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if ((p_confirm || cmdmod.confirm) && p_write) { dialog_changed(buf, FALSE); - # ifdef FEAT_AUTOCMD if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed * now. */ return FAIL; - # endif /* If it's still changed fail silently, the dialog already * mentioned why it fails. */ if (bufIsChanged(buf)) return FAIL; } else ! #endif { EMSGN(_("E89: No write since last change for buffer %ld (add ! to override)"), buf->b_fnum); --- 1370,1390 ---- if (!forceit && bufIsChanged(buf)) { ! # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if ((p_confirm || cmdmod.confirm) && p_write) { dialog_changed(buf, FALSE); if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed * now. */ return FAIL; /* If it's still changed fail silently, the dialog already * mentioned why it fails. */ if (bufIsChanged(buf)) return FAIL; } else ! # endif { EMSGN(_("E89: No write since last change for buffer %ld (add ! to override)"), buf->b_fnum); *************** *** 1444,1452 **** * a window with this buffer. */ while (buf == curbuf - #ifdef FEAT_AUTOCMD && !(curwin->w_closing || curwin->w_buffer->b_locked > 0) - #endif && (!ONE_WINDOW || first_tabpage->tp_next != NULL)) { if (win_close(curwin, FALSE) == FAIL) --- 1412,1418 ---- *************** *** 1476,1490 **** */ buf = NULL; /* selected buffer */ bp = NULL; /* used when no loaded buffer found */ - #ifdef FEAT_AUTOCMD if (au_new_curbuf.br_buf != NULL && bufref_valid(&au_new_curbuf)) buf = au_new_curbuf.br_buf; - # ifdef FEAT_JUMPLIST - else - # endif - #endif #ifdef FEAT_JUMPLIST ! if (curwin->w_jumplistlen > 0) { int jumpidx; --- 1442,1451 ---- */ buf = NULL; /* selected buffer */ bp = NULL; /* used when no loaded buffer found */ if (au_new_curbuf.br_buf != NULL && bufref_valid(&au_new_curbuf)) buf = au_new_curbuf.br_buf; #ifdef FEAT_JUMPLIST ! else if (curwin->w_jumplistlen > 0) { int jumpidx; *************** *** 1603,1619 **** #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if ((p_confirm || cmdmod.confirm) && p_write) { - # ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); - # endif dialog_changed(curbuf, FALSE); - # ifdef FEAT_AUTOCMD if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! */ return FAIL; - # endif } if (bufIsChanged(curbuf)) #endif --- 1564,1576 ---- *************** *** 1634,1640 **** } #endif ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return FAIL; #endif --- 1591,1597 ---- } #endif ! #if defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return FAIL; #endif *************** *** 1678,1694 **** set_bufref(&prevbufref, prevbuf); set_bufref(&newbufref, buf); - #ifdef FEAT_AUTOCMD /* Autocommands may delete the curren buffer and/or the buffer we wan to go * to. In those cases don't close the buffer. */ if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf) || (bufref_valid(&prevbufref) && bufref_valid(&newbufref) ! # ifdef FEAT_EVAL && !aborting() - # endif - )) #endif { #ifdef FEAT_SYN_HL if (prevbuf == curwin->w_buffer) --- 1635,1649 ---- set_bufref(&prevbufref, prevbuf); set_bufref(&newbufref, buf); /* Autocommands may delete the curren buffer and/or the buffer we wan to go * to. In those cases don't close the buffer. */ if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf) || (bufref_valid(&prevbufref) && bufref_valid(&newbufref) ! #ifdef FEAT_EVAL && !aborting() #endif + )) { #ifdef FEAT_SYN_HL if (prevbuf == curwin->w_buffer) *************** *** 1696,1702 **** #endif if (unload) close_windows(prevbuf, FALSE); ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (bufref_valid(&prevbufref) && !aborting()) #else if (bufref_valid(&prevbufref)) --- 1651,1657 ---- #endif if (unload) close_windows(prevbuf, FALSE); ! #if defined(FEAT_EVAL) if (bufref_valid(&prevbufref) && !aborting()) #else if (bufref_valid(&prevbufref)) *************** *** 1714,1729 **** curwin = previouswin; } } - #ifdef FEAT_AUTOCMD /* An autocommand may have deleted "buf", already entered it (e.g., when * it did ":bunload") or aborted the script processing. * If curwin->w_buffer is null, enter_buffer() will make it valid again */ if ((buf_valid(buf) && buf != curbuf ! # ifdef FEAT_EVAL && !aborting() - # endif - ) || curwin->w_buffer == NULL) #endif { enter_buffer(buf); #ifdef FEAT_SYN_HL --- 1669,1682 ---- curwin = previouswin; } } /* An autocommand may have deleted "buf", already entered it (e.g., when * it did ":bunload") or aborted the script processing. * If curwin->w_buffer is null, enter_buffer() will make it valid again */ if ((buf_valid(buf) && buf != curbuf ! #ifdef FEAT_EVAL && !aborting() #endif + ) || curwin->w_buffer == NULL) { enter_buffer(buf); #ifdef FEAT_SYN_HL *************** *** 1773,1781 **** curwin->w_cursor.coladd = 0; #endif curwin->w_set_curswant = TRUE; - #ifdef FEAT_AUTOCMD curwin->w_topline_was_set = FALSE; - #endif /* mark cursor position as being invalid */ curwin->w_valid = 0; --- 1726,1732 ---- *************** *** 1783,1795 **** /* Make sure the buffer is loaded. */ if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */ { - #ifdef FEAT_AUTOCMD /* If there is no filetype, allow for detecting one. Esp. useful for * ":ball" used in a autocommand. If there already is a filetype we * might prefer to keep it. */ if (*curbuf->b_p_ft == NUL) did_filetype = FALSE; - #endif open_buffer(FALSE, NULL, 0); } --- 1734,1744 ---- *************** *** 1798,1811 **** if (!msg_silent) need_fileinfo = TRUE; /* display file info after redraw */ (void)buf_check_timestamp(curbuf, FALSE); /* check if file changed */ - #ifdef FEAT_AUTOCMD curwin->w_topline = 1; ! # ifdef FEAT_DIFF curwin->w_topfill = 0; ! # endif apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); - #endif } /* If autocommands did not change the cursor position, restore cursor lnum --- 1747,1758 ---- if (!msg_silent) need_fileinfo = TRUE; /* display file info after redraw */ (void)buf_check_timestamp(curbuf, FALSE); /* check if file changed */ curwin->w_topline = 1; ! #ifdef FEAT_DIFF curwin->w_topfill = 0; ! #endif apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); } /* If autocommands did not change the cursor position, restore cursor lnum *************** *** 1817,1826 **** #ifdef FEAT_TITLE maketitle(); #endif - #ifdef FEAT_AUTOCMD /* when autocmds didn't change it */ if (curwin->w_topline == 1 && !curwin->w_topline_was_set) - #endif scroll_cursor_halfway(FALSE); /* redisplay at correct position */ #ifdef FEAT_NETBEANS_INTG --- 1764,1771 ---- *************** *** 1948,1958 **** if ((flags & BLN_LISTED) && !buf->b_p_bl) { - #ifdef FEAT_AUTOCMD bufref_T bufref; ! #endif buf->b_p_bl = TRUE; - #ifdef FEAT_AUTOCMD set_bufref(&bufref, buf); if (!(flags & BLN_DUMMY)) { --- 1893,1901 ---- if ((flags & BLN_LISTED) && !buf->b_p_bl) { bufref_T bufref; ! buf->b_p_bl = TRUE; set_bufref(&bufref, buf); if (!(flags & BLN_DUMMY)) { *************** *** 1960,1966 **** && !bufref_valid(&bufref)) return NULL; } - #endif } return buf; } --- 1903,1908 ---- *************** *** 1981,2001 **** && (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY())) { buf = curbuf; - #ifdef FEAT_AUTOCMD /* It's like this buffer is deleted. Watch out for autocommands that * change curbuf! If that happens, allocate a new buffer anyway. */ if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); if (buf == curbuf) apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return NULL; - # endif #endif - #ifdef FEAT_AUTOCMD if (buf == curbuf) - #endif { /* Make sure 'bufhidden' and 'buftype' are empty */ clear_string_option(&buf->b_p_bh); --- 1923,1939 ---- && (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY())) { buf = curbuf; /* It's like this buffer is deleted. Watch out for autocommands that * change curbuf! If that happens, allocate a new buffer anyway. */ if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); if (buf == curbuf) apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return NULL; #endif if (buf == curbuf) { /* Make sure 'bufhidden' and 'buftype' are empty */ clear_string_option(&buf->b_p_bh); *************** *** 2049,2055 **** buf_freeall(buf, 0); if (buf != curbuf) /* autocommands deleted the buffer! */ return NULL; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return NULL; #endif --- 1987,1993 ---- buf_freeall(buf, 0); if (buf != curbuf) /* autocommands deleted the buffer! */ return NULL; ! #if defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return NULL; #endif *************** *** 2128,2134 **** clrallmarks(buf); /* clear marks */ fmarks_check_names(buf); /* check file marks for this file */ buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */ - #ifdef FEAT_AUTOCMD if (!(flags & BLN_DUMMY)) { bufref_T bufref; --- 2066,2071 ---- *************** *** 2146,2157 **** && !bufref_valid(&bufref)) return NULL; } ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return NULL; - # endif - } #endif return buf; } --- 2083,2093 ---- && !bufref_valid(&bufref)) return NULL; } ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return NULL; #endif + } return buf; } *************** *** 2230,2238 **** #ifdef FEAT_SEARCHPATH clear_string_option(&buf->b_p_sua); #endif - #ifdef FEAT_AUTOCMD clear_string_option(&buf->b_p_ft); - #endif #ifdef FEAT_CINDENT clear_string_option(&buf->b_p_cink); clear_string_option(&buf->b_p_cino); --- 2166,2172 ---- *************** *** 2315,2324 **** text_locked_msg(); return FAIL; } - #ifdef FEAT_AUTOCMD if (curbuf_locked()) return FAIL; - #endif /* altfpos may be changed by getfile(), get it now */ if (lnum == 0) --- 2249,2256 ---- *************** *** 4368,4374 **** : _("[Help]")); break; - #ifdef FEAT_AUTOCMD case STL_FILETYPE: if (*wp->w_buffer->b_p_ft != NUL && STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 3) --- 4300,4305 ---- *************** *** 4391,4397 **** str = tmp; } break; - #endif #if defined(FEAT_QUICKFIX) case STL_PREVIEWFLAG: --- 4322,4327 ---- *************** *** 5013,5032 **** if (!buf_hide(buf) && buf->b_nwindows <= 1 && bufIsChanged(buf)) { - #ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); ! #endif (void)autowrite(buf, FALSE); ! #ifdef FEAT_AUTOCMD /* check if autocommands removed the window */ if (!win_valid(wp) || !bufref_valid(&bufref)) { wpnext = firstwin; /* start all over... */ continue; } - #endif } /* don't close last window */ if (ONE_WINDOW --- 4943,4960 ---- if (!buf_hide(buf) && buf->b_nwindows <= 1 && bufIsChanged(buf)) { bufref_T bufref; set_bufref(&bufref, buf); ! (void)autowrite(buf, FALSE); ! /* check if autocommands removed the window */ if (!win_valid(wp) || !bufref_valid(&bufref)) { wpnext = firstwin; /* start all over... */ continue; } } /* don't close last window */ if (ONE_WINDOW *************** *** 5035,5045 **** else { win_close(wp, !buf_hide(buf) && !bufIsChanged(buf)); ! #ifdef FEAT_AUTOCMD /* check if autocommands removed the next window */ if (!win_valid(wpnext)) wpnext = firstwin; /* start all over... */ - #endif } } } --- 4963,4972 ---- else { win_close(wp, !buf_hide(buf) && !bufIsChanged(buf)); ! /* check if autocommands removed the next window */ if (!win_valid(wpnext)) wpnext = firstwin; /* start all over... */ } } } *************** *** 5049,5059 **** if (had_tab == 0 || tpnext == NULL) break; - # ifdef FEAT_AUTOCMD /* check if autocommands removed the next tab page */ if (!valid_tabpage(tpnext)) tpnext = first_tabpage; /* start all over...*/ ! # endif goto_tabpage_tp(tpnext, TRUE, TRUE); } --- 4976,4985 ---- if (had_tab == 0 || tpnext == NULL) break; /* check if autocommands removed the next tab page */ if (!valid_tabpage(tpnext)) tpnext = first_tabpage; /* start all over...*/ ! goto_tabpage_tp(tpnext, TRUE, TRUE); } *************** *** 5064,5074 **** if (count > opened_len || count <= 0) count = opened_len; - #ifdef FEAT_AUTOCMD /* Don't execute Win/Buf Enter/Leave autocommands here. */ ++autocmd_no_enter; ++autocmd_no_leave; - #endif last_curwin = curwin; last_curtab = curtab; win_enter(lastwin, FALSE); --- 4990,4998 ---- *************** *** 5114,5123 **** if (split_ret == FAIL) continue; } - #ifdef FEAT_AUTOCMD else /* first window: do autocmd for leaving this buffer */ --autocmd_no_leave; - #endif /* * edit file "i" --- 5038,5045 ---- *************** *** 5133,5142 **** ((buf_hide(curwin->w_buffer) || bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0) + ECMD_OLDBUF, curwin); - #ifdef FEAT_AUTOCMD if (use_firstwin) ++autocmd_no_leave; - #endif use_firstwin = FALSE; } ui_breakcheck(); --- 5055,5062 ---- *************** *** 5149,5157 **** /* Remove the "lock" on the argument list. */ alist_unlink(alist); - #ifdef FEAT_AUTOCMD --autocmd_no_enter; ! #endif /* restore last referenced tabpage's curwin */ if (last_curtab != new_curtab) { --- 5069,5076 ---- /* Remove the "lock" on the argument list. */ alist_unlink(alist); --autocmd_no_enter; ! /* restore last referenced tabpage's curwin */ if (last_curtab != new_curtab) { *************** *** 5166,5174 **** if (win_valid(new_curwin)) win_enter(new_curwin, FALSE); - #ifdef FEAT_AUTOCMD --autocmd_no_leave; - #endif vim_free(opened); } --- 5085,5091 ---- *************** *** 5223,5240 **** - tabline_height() : wp->w_width != Columns) || (had_tab > 0 && wp != firstwin)) && !ONE_WINDOW ! #ifdef FEAT_AUTOCMD ! && !(wp->w_closing || wp->w_buffer->b_locked > 0) ! #endif ! ) { win_close(wp, FALSE); - #ifdef FEAT_AUTOCMD wpnext = firstwin; /* just in case an autocommand does something strange with windows */ tpnext = first_tabpage; /* start all over...*/ open_wins = 0; - #endif } else ++open_wins; --- 5140,5152 ---- - tabline_height() : wp->w_width != Columns) || (had_tab > 0 && wp != firstwin)) && !ONE_WINDOW ! && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { win_close(wp, FALSE); wpnext = firstwin; /* just in case an autocommand does something strange with windows */ tpnext = first_tabpage; /* start all over...*/ open_wins = 0; } else ++open_wins; *************** *** 5251,5264 **** * open one. Otherwise move the window to the right position. * Watch out for autocommands that delete buffers or windows! */ - #ifdef FEAT_AUTOCMD /* Don't execute Win/Buf Enter/Leave autocommands here. */ ++autocmd_no_enter; - #endif win_enter(lastwin, FALSE); - #ifdef FEAT_AUTOCMD ++autocmd_no_leave; - #endif for (buf = firstbuf; buf != NULL && open_wins < count; buf = buf->b_next) { /* Check if this buffer needs a window */ --- 5163,5172 ---- *************** *** 5286,5296 **** if (wp == NULL && split_ret == OK) { - #ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); ! #endif /* Split the window and put the buffer in it */ p_ea_save = p_ea; p_ea = TRUE; /* use space from all windows */ --- 5194,5203 ---- if (wp == NULL && split_ret == OK) { bufref_T bufref; set_bufref(&bufref, buf); ! /* Split the window and put the buffer in it */ p_ea_save = p_ea; p_ea = TRUE; /* use space from all windows */ *************** *** 5305,5324 **** swap_exists_action = SEA_DIALOG; #endif set_curbuf(buf, DOBUF_GOTO); - #ifdef FEAT_AUTOCMD if (!bufref_valid(&bufref)) { /* autocommands deleted the buffer!!! */ #if defined(HAS_SWAP_EXISTS_ACTION) swap_exists_action = SEA_NONE; ! # endif break; } - #endif #if defined(HAS_SWAP_EXISTS_ACTION) if (swap_exists_action == SEA_QUIT) { ! # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that --- 5212,5229 ---- swap_exists_action = SEA_DIALOG; #endif set_curbuf(buf, DOBUF_GOTO); if (!bufref_valid(&bufref)) { /* autocommands deleted the buffer!!! */ #if defined(HAS_SWAP_EXISTS_ACTION) swap_exists_action = SEA_NONE; ! #endif break; } #if defined(HAS_SWAP_EXISTS_ACTION) if (swap_exists_action == SEA_QUIT) { ! # if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that *************** *** 5332,5338 **** swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; ! # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not * discarded by a new aborting error, interrupt, or uncaught * exception. */ --- 5237,5243 ---- swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; ! # if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not * discarded by a new aborting error, interrupt, or uncaught * exception. */ *************** *** 5359,5371 **** if (had_tab > 0 && tabpage_index(NULL) <= p_tpm) cmdmod.tab = 9999; } - #ifdef FEAT_AUTOCMD --autocmd_no_enter; - #endif win_enter(firstwin, FALSE); /* back to first window */ - #ifdef FEAT_AUTOCMD --autocmd_no_leave; - #endif /* * Close superfluous windows. --- 5264,5272 ---- *************** *** 5374,5388 **** { r = (buf_hide(wp->w_buffer) || !bufIsChanged(wp->w_buffer) || autowrite(wp->w_buffer, FALSE) == OK); - #ifdef FEAT_AUTOCMD if (!win_valid(wp)) { /* BufWrite Autocommands made the window invalid, start over */ wp = lastwin; } ! else ! #endif ! if (r) { win_close(wp, !buf_hide(wp->w_buffer)); --open_wins; --- 5275,5286 ---- { r = (buf_hide(wp->w_buffer) || !bufIsChanged(wp->w_buffer) || autowrite(wp->w_buffer, FALSE) == OK); if (!win_valid(wp)) { /* BufWrite Autocommands made the window invalid, start over */ wp = lastwin; } ! else if (r) { win_close(wp, !buf_hide(wp->w_buffer)); --open_wins; *************** *** 6233,6244 **** if (on != curbuf->b_p_bl) { curbuf->b_p_bl = on; - #ifdef FEAT_AUTOCMD if (on) apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf); else apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); - #endif } } --- 6131,6140 ---- *************** *** 6311,6323 **** if (buf->b_fnum == top_file_num - 1) --top_file_num; - #ifdef FEAT_AUTOCMD if (!aucmd) /* Don't trigger BufDelete autocommands here. */ block_autocmds(); ! #endif close_buffer(NULL, buf, DOBUF_WIPE, FALSE); ! #ifdef FEAT_AUTOCMD if (!aucmd) unblock_autocmds(); - #endif } --- 6207,6217 ---- if (buf->b_fnum == top_file_num - 1) --top_file_num; if (!aucmd) /* Don't trigger BufDelete autocommands here. */ block_autocmds(); ! close_buffer(NULL, buf, DOBUF_WIPE, FALSE); ! if (!aucmd) unblock_autocmds(); } *** ../vim-8.0.1563/src/diff.c 2017-12-01 20:35:54.868077089 +0100 --- src/diff.c 2018-03-04 15:42:19.459839199 +0100 *************** *** 872,884 **** (diff_flags & DIFF_ICASE) ? "-i " : "", tmp_orig, tmp_new); append_redir(cmd, (int)len, p_srr, tmp_diff); - #ifdef FEAT_AUTOCMD block_autocmds(); /* Avoid ShellCmdPost stuff */ - #endif (void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT); - #ifdef FEAT_AUTOCMD unblock_autocmds(); - #endif vim_free(cmd); } } --- 872,880 ---- *************** *** 984,996 **** * cooked mode to allow the user to respond to prompts. */ vim_snprintf((char *)buf, buflen, "patch -o %s %s < %s", tmp_new, tmp_orig, esc_name); - #ifdef FEAT_AUTOCMD block_autocmds(); /* Avoid ShellCmdPost stuff */ - #endif (void)call_shell(buf, SHELL_FILTER | SHELL_COOKED); - #ifdef FEAT_AUTOCMD unblock_autocmds(); - #endif } #ifdef UNIX --- 980,988 ---- *************** *** 1052,1062 **** eap->arg = newname; ex_file(eap); - #ifdef FEAT_AUTOCMD /* Do filetype detection with the new name. */ if (au_has_group((char_u *)"filetypedetect")) do_cmdline_cmd((char_u *)":doau filetypedetect BufRead"); - #endif } } } --- 1044,1052 ---- *** ../vim-8.0.1563/src/edit.c 2018-02-10 18:45:21.044822330 +0100 --- src/edit.c 2018-03-04 16:56:55.235083696 +0100 *************** *** 273,279 **** static void ins_try_si(int c); #endif static colnr_T get_nolist_virtcol(void); ! #ifdef FEAT_AUTOCMD static char_u *do_insert_char_pre(int c); #endif --- 273,279 ---- static void ins_try_si(int c); #endif static colnr_T get_nolist_virtcol(void); ! #if defined(FEAT_EVAL) static char_u *do_insert_char_pre(int c); #endif *************** *** 388,394 **** ins_compl_clear(); /* clear stuff for CTRL-X mode */ #endif - #ifdef FEAT_AUTOCMD /* * Trigger InsertEnter autocommands. Do not do this for "r" or "grx". */ --- 388,393 ---- *************** *** 396,402 **** { pos_T save_cursor = curwin->w_cursor; ! # ifdef FEAT_EVAL if (cmdchar == 'R') ptr = (char_u *)"r"; else if (cmdchar == 'V') --- 395,401 ---- { pos_T save_cursor = curwin->w_cursor; ! #ifdef FEAT_EVAL if (cmdchar == 'R') ptr = (char_u *)"r"; else if (cmdchar == 'V') *************** *** 405,411 **** ptr = (char_u *)"i"; set_vim_var_string(VV_INSERTMODE, ptr, 1); set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */ ! # endif apply_autocmds(EVENT_INSERTENTER, NULL, NULL, FALSE, curbuf); /* Make sure the cursor didn't move. Do call check_cursor_col() in --- 404,410 ---- ptr = (char_u *)"i"; set_vim_var_string(VV_INSERTMODE, ptr, 1); set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */ ! #endif apply_autocmds(EVENT_INSERTENTER, NULL, NULL, FALSE, curbuf); /* Make sure the cursor didn't move. Do call check_cursor_col() in *************** *** 415,423 **** * line number is still valid (lines may have been deleted). * Do not restore if v:char was set to a non-empty string. */ if (!EQUAL_POS(curwin->w_cursor, save_cursor) ! # ifdef FEAT_EVAL && *get_vim_var_str(VV_CHAR) == NUL ! # endif && save_cursor.lnum <= curbuf->b_ml.ml_line_count) { int save_state = State; --- 414,422 ---- * line number is still valid (lines may have been deleted). * Do not restore if v:char was set to a non-empty string. */ if (!EQUAL_POS(curwin->w_cursor, save_cursor) ! #ifdef FEAT_EVAL && *get_vim_var_str(VV_CHAR) == NUL ! #endif && save_cursor.lnum <= curbuf->b_ml.ml_line_count) { int save_state = State; *************** *** 428,434 **** State = save_state; } } - #endif #ifdef FEAT_CONCEAL /* Check if the cursor line needs redrawing before changing State. If --- 427,432 ---- *************** *** 521,527 **** */ if (curbuf->b_p_iminsert == B_IMODE_LMAP) State |= LANGMAP; ! #ifdef FEAT_MBYTE im_set_active(curbuf->b_p_iminsert == B_IMODE_IM); #endif --- 519,525 ---- */ if (curbuf->b_p_iminsert == B_IMODE_LMAP) State |= LANGMAP; ! #ifdef HAVE_INPUT_METHOD im_set_active(curbuf->b_p_iminsert == B_IMODE_IM); #endif *************** *** 805,814 **** c = safe_vgetc(); } while (c == K_IGNORE || c == K_NOP); - #ifdef FEAT_AUTOCMD /* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */ did_cursorhold = TRUE; - #endif #ifdef FEAT_RIGHTLEFT if (p_hkmap && KeyTyped) --- 803,810 ---- *************** *** 856,862 **** * completion: Add to "compl_leader". */ if (ins_compl_accept_char(c)) { ! #ifdef FEAT_AUTOCMD /* Trigger InsertCharPre. */ char_u *str = do_insert_char_pre(c); char_u *p; --- 852,858 ---- * completion: Add to "compl_leader". */ if (ins_compl_accept_char(c)) { ! #if defined(FEAT_EVAL) /* Trigger InsertCharPre. */ char_u *str = do_insert_char_pre(c); char_u *p; *************** *** 1030,1041 **** if (ins_esc(&count, cmdchar, nomove)) { - #ifdef FEAT_AUTOCMD if (cmdchar != 'r' && cmdchar != 'v') apply_autocmds(EVENT_INSERTLEAVE, NULL, NULL, FALSE, curbuf); did_cursorhold = FALSE; - #endif return (c == Ctrl_O); } continue; --- 1026,1035 ---- *************** *** 1234,1245 **** case K_IGNORE: /* Something mapped to nothing */ break; - #ifdef FEAT_AUTOCMD case K_CURSORHOLD: /* Didn't type something for a while. */ apply_autocmds(EVENT_CURSORHOLDI, NULL, NULL, FALSE, curbuf); did_cursorhold = TRUE; break; - #endif #ifdef FEAT_GUI_W32 /* On Win32 ignore , we get it when closing the window was --- 1228,1237 ---- *************** *** 1488,1494 **** /* * Insert a normal character. */ ! #ifdef FEAT_AUTOCMD if (!p_paste) { /* Trigger InsertCharPre. */ --- 1480,1486 ---- /* * Insert a normal character. */ ! #if defined(FEAT_EVAL) if (!p_paste) { /* Trigger InsertCharPre. */ *************** *** 1565,1580 **** break; } /* end of switch (c) */ - #ifdef FEAT_AUTOCMD /* If typed something may trigger CursorHoldI again. */ if (c != K_CURSORHOLD ! # ifdef FEAT_COMPL_FUNC /* but not in CTRL-X mode, a script can't restore the state */ && ctrl_x_mode == CTRL_X_NORMAL ! # endif ) did_cursorhold = FALSE; - #endif /* If the cursor was moved we didn't just insert a space */ if (arrow_used) --- 1557,1570 ---- break; } /* end of switch (c) */ /* If typed something may trigger CursorHoldI again. */ if (c != K_CURSORHOLD ! #ifdef FEAT_COMPL_FUNC /* but not in CTRL-X mode, a script can't restore the state */ && ctrl_x_mode == CTRL_X_NORMAL ! #endif ) did_cursorhold = FALSE; /* If the cursor was moved we didn't just insert a space */ if (arrow_used) *************** *** 1624,1648 **** if (char_avail()) return; ! #if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) /* Trigger CursorMoved if the cursor moved. Not when the popup menu is * visible, the command might delete it. */ ! if (ready && ( ! # ifdef FEAT_AUTOCMD ! has_cursormovedI() ! # endif ! # if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL) ! || ! # endif ! # ifdef FEAT_CONCEAL ! curwin->w_p_cole > 0 # endif ) ! # ifdef FEAT_AUTOCMD ! && !EQUAL_POS(last_cursormoved, curwin->w_cursor) ! # endif # ifdef FEAT_INS_EXPAND ! && !pum_visible() # endif ) { --- 1614,1630 ---- if (char_avail()) return; ! #if defined(FEAT_CONCEAL) /* Trigger CursorMoved if the cursor moved. Not when the popup menu is * visible, the command might delete it. */ ! if (ready && (has_cursormovedI() ! # if defined(FEAT_CONCEAL) ! || curwin->w_p_cole > 0 # endif ) ! && !EQUAL_POS(last_cursormoved, curwin->w_cursor) # ifdef FEAT_INS_EXPAND ! && !pum_visible() # endif ) { *************** *** 1654,1660 **** if (syntax_present(curwin) && must_redraw) update_screen(0); # endif - # ifdef FEAT_AUTOCMD if (has_cursormovedI()) { /* Make sure curswant is correct, an autocommand may call --- 1636,1641 ---- *************** *** 1662,1698 **** update_curswant(); apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf); } - # endif # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { - # ifdef FEAT_AUTOCMD conceal_old_cursor_line = last_cursormoved.lnum; - # endif conceal_new_cursor_line = curwin->w_cursor.lnum; conceal_update_lines = TRUE; } # endif - # ifdef FEAT_AUTOCMD last_cursormoved = curwin->w_cursor; - # endif } #endif - #ifdef FEAT_AUTOCMD /* Trigger TextChangedI if b_changedtick differs. */ if (ready && has_textchangedI() && curbuf->b_last_changedtick != CHANGEDTICK(curbuf) ! # ifdef FEAT_INS_EXPAND && !pum_visible() ! # endif ) { apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf); curbuf->b_last_changedtick = CHANGEDTICK(curbuf); } ! # ifdef FEAT_INS_EXPAND /* Trigger TextChangedP if b_changedtick differs. When the popupmenu closes * TextChangedI will need to trigger for backwards compatibility, thus use * different b_last_changedtick* variables. */ --- 1643,1673 ---- update_curswant(); apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf); } # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { conceal_old_cursor_line = last_cursormoved.lnum; conceal_new_cursor_line = curwin->w_cursor.lnum; conceal_update_lines = TRUE; } # endif last_cursormoved = curwin->w_cursor; } #endif /* Trigger TextChangedI if b_changedtick differs. */ if (ready && has_textchangedI() && curbuf->b_last_changedtick != CHANGEDTICK(curbuf) ! #ifdef FEAT_INS_EXPAND && !pum_visible() ! #endif ) { apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf); curbuf->b_last_changedtick = CHANGEDTICK(curbuf); } ! #ifdef FEAT_INS_EXPAND /* Trigger TextChangedP if b_changedtick differs. When the popupmenu closes * TextChangedI will need to trigger for backwards compatibility, thus use * different b_last_changedtick* variables. */ *************** *** 1703,1709 **** apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, FALSE, curbuf); curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf); } - # endif #endif if (must_redraw) --- 1678,1683 ---- *************** *** 4001,4019 **** if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0))) do_c_expr_indent(); #endif - #ifdef FEAT_AUTOCMD /* Trigger the CompleteDone event to give scripts a chance to act * upon the completion. */ apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf); - #endif } } - #ifdef FEAT_AUTOCMD else if (ctrl_x_mode == CTRL_X_LOCAL_MSG) /* Trigger the CompleteDone event to give scripts a chance to act * upon the (possibly failed) completion. */ apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf); - #endif /* reset continue_* if we left expansion-mode, if we stay they'll be * (re)set properly in ins_complete() */ --- 3975,3989 ---- *************** *** 6224,6233 **** #ifdef FEAT_RIGHTLEFT && !p_ri #endif ! #ifdef FEAT_AUTOCMD ! && !has_insertcharpre() ! #endif ! ) { #define INPUT_BUFLEN 100 char_u buf[INPUT_BUFLEN + 1]; --- 6194,6200 ---- #ifdef FEAT_RIGHTLEFT && !p_ri #endif ! && !has_insertcharpre()) { #define INPUT_BUFLEN 100 char_u buf[INPUT_BUFLEN + 1]; *************** *** 8404,8410 **** ++no_u_sync; if (regname == '=') { ! # ifdef FEAT_MBYTE int im_on = im_get_status(); # endif /* Sync undo when evaluating the expression calls setline() or --- 8371,8377 ---- ++no_u_sync; if (regname == '=') { ! # ifdef HAVE_INPUT_METHOD int im_on = im_get_status(); # endif /* Sync undo when evaluating the expression calls setline() or *************** *** 8412,8418 **** u_sync_once = 2; regname = get_expr_register(); ! # ifdef FEAT_MBYTE /* Restore the Input Method. */ if (im_on) im_set_active(TRUE); --- 8379,8385 ---- u_sync_once = 2; regname = get_expr_register(); ! # ifdef HAVE_INPUT_METHOD /* Restore the Input Method. */ if (im_on) im_set_active(TRUE); *************** *** 8541,8552 **** { curbuf->b_p_iminsert = B_IMODE_LMAP; State |= LANGMAP; ! #ifdef FEAT_MBYTE im_set_active(FALSE); #endif } } ! #ifdef FEAT_MBYTE else { /* There are no ":lmap" mappings, toggle IM */ --- 8508,8519 ---- { curbuf->b_p_iminsert = B_IMODE_LMAP; State |= LANGMAP; ! #ifdef HAVE_INPUT_METHOD im_set_active(FALSE); #endif } } ! #ifdef HAVE_INPUT_METHOD else { /* There are no ":lmap" mappings, toggle IM */ *************** *** 8693,8699 **** } } ! #ifdef FEAT_MBYTE /* Disable IM to allow typing English directly for Normal mode commands. * When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as * well). */ --- 8660,8666 ---- } } ! #ifdef HAVE_INPUT_METHOD /* Disable IM to allow typing English directly for Normal mode commands. * When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as * well). */ *************** *** 8843,8849 **** } #endif - #ifdef FEAT_AUTOCMD # ifdef FEAT_EVAL set_vim_var_string(VV_INSERTMODE, (char_u *)((State & REPLACE_FLAG) ? "i" : --- 8810,8815 ---- *************** *** 8853,8859 **** "r"), 1); # endif apply_autocmds(EVENT_INSERTCHANGE, NULL, NULL, FALSE, curbuf); - #endif if (State & REPLACE_FLAG) State = INSERT | (State & LANGMAP); else --- 8819,8824 ---- *************** *** 10573,10579 **** return curwin->w_virtcol; } ! #ifdef FEAT_AUTOCMD /* * Handle the InsertCharPre autocommand. * "c" is the character that was typed. --- 10538,10544 ---- return curwin->w_virtcol; } ! #if defined(FEAT_EVAL) /* * Handle the InsertCharPre autocommand. * "c" is the character that was typed. *************** *** 10590,10600 **** if (!has_insertcharpre()) return NULL; ! #ifdef FEAT_MBYTE if (has_mbyte) buf[(*mb_char2bytes)(c, buf)] = NUL; else ! #endif { buf[0] = c; buf[1] = NUL; --- 10555,10565 ---- if (!has_insertcharpre()) return NULL; ! # ifdef FEAT_MBYTE if (has_mbyte) buf[(*mb_char2bytes)(c, buf)] = NUL; else ! # endif { buf[0] = c; buf[1] = NUL; *** ../vim-8.0.1563/src/eval.c 2018-02-20 21:46:00.925600468 +0100 --- src/eval.c 2018-03-04 15:45:53.710494801 +0100 *************** *** 5125,5135 **** FOR_ALL_TAB_WINDOWS(tp, wp) abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID, NULL, NULL); - #ifdef FEAT_AUTOCMD if (aucmd_win != NULL) abort = abort || set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID, NULL, NULL); - #endif /* tabpage-local variables */ FOR_ALL_TABPAGES(tp) --- 5125,5133 ---- *************** *** 6560,6566 **** return NULL; } - #if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Set v:cmdarg. * If "eap" != NULL, use "eap" to generate the value and return the old value. --- 6558,6563 ---- *************** *** 6618,6624 **** if (eap->force_ff != 0) sprintf((char *)newval + STRLEN(newval), " ++ff=%s", eap->cmd + eap->force_ff); ! # ifdef FEAT_MBYTE if (eap->force_enc != 0) sprintf((char *)newval + STRLEN(newval), " ++enc=%s", eap->cmd + eap->force_enc); --- 6615,6621 ---- if (eap->force_ff != 0) sprintf((char *)newval + STRLEN(newval), " ++ff=%s", eap->cmd + eap->force_ff); ! #ifdef FEAT_MBYTE if (eap->force_enc != 0) sprintf((char *)newval + STRLEN(newval), " ++enc=%s", eap->cmd + eap->force_enc); *************** *** 6628,6638 **** STRCPY(newval + STRLEN(newval), " ++bad=drop"); else if (eap->bad_char != 0) sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char); ! # endif vimvars[VV_CMDARG].vv_str = newval; return oldval; } - #endif /* * Get the value of internal variable "name". --- 6625,6634 ---- STRCPY(newval + STRLEN(newval), " ++bad=drop"); else if (eap->bad_char != 0) sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char); ! #endif vimvars[VV_CMDARG].vv_str = newval; return oldval; } /* * Get the value of internal variable "name". *** ../vim-8.0.1563/src/evalfunc.c 2018-03-03 21:29:46.918813940 +0100 --- src/evalfunc.c 2018-03-04 15:46:15.634357367 +0100 *************** *** 2668,2676 **** static void f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { - #ifdef FEAT_AUTOCMD rettv->vval.v_number = did_filetype; - #endif } /* --- 2668,2674 ---- *************** *** 3053,3064 **** } else if (*p == '#') { - #ifdef FEAT_AUTOCMD if (p[1] == '#') n = autocmd_supported(p + 2); else n = au_exists(p + 1); - #endif } else /* internal variable */ { --- 3051,3060 ---- *************** *** 5797,5805 **** #ifdef FEAT_ARABIC "arabic", #endif - #ifdef FEAT_AUTOCMD "autocmd", - #endif #ifdef FEAT_AUTOSERVERNAME "autoservername", #endif --- 5793,5799 ---- *** ../vim-8.0.1563/src/ex_cmds.c 2018-02-27 21:08:48.272513006 +0100 --- src/ex_cmds.c 2018-03-04 15:51:20.508419961 +0100 *************** *** 28,36 **** #endif static int check_readonly(int *forceit, buf_T *buf); - #ifdef FEAT_AUTOCMD static void delbuf_msg(char_u *name); - #endif static int #ifdef __BORLANDC__ _RTLENTRYF --- 28,34 ---- *************** *** 1148,1156 **** /* Careful: This may recursively call do_bang() again! (because of * autocommands) */ do_filter(line1, line2, eap, newcmd, do_in, do_out); - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, FALSE, curbuf); - #endif } if (free_newcmd) vim_free(newcmd); --- 1146,1152 ---- *************** *** 1186,1194 **** linenr_T read_linecount; pos_T cursor_save; char_u *cmd_buf; - #ifdef FEAT_AUTOCMD buf_T *old_curbuf = curbuf; - #endif int shell_flags = 0; if (*cmd == NUL) /* no filter command */ --- 1182,1188 ---- *************** *** 1259,1274 **** { msg_putchar('\n'); /* keep message from buf_write() */ --no_wait_return; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (!aborting()) #endif (void)EMSG2(_(e_notcreate), itmp); /* will call wait_return */ goto filterend; } - #ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) goto filterend; - #endif if (!do_out) msg_putchar('\n'); --- 1253,1266 ---- { msg_putchar('\n'); /* keep message from buf_write() */ --no_wait_return; ! #if defined(FEAT_EVAL) if (!aborting()) #endif (void)EMSG2(_(e_notcreate), itmp); /* will call wait_return */ goto filterend; } if (curbuf != old_curbuf) goto filterend; if (!do_out) msg_putchar('\n'); *************** *** 1334,1340 **** if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, READ_FILTER) != OK) { ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (!aborting()) #endif { --- 1326,1332 ---- if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, READ_FILTER) != OK) { ! #if defined(FEAT_EVAL) if (!aborting()) #endif { *************** *** 1343,1352 **** } goto error; } - #ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) goto filterend; - #endif } read_linecount = curbuf->b_ml.ml_line_count - read_linecount; --- 1335,1342 ---- *************** *** 1426,1438 **** filterend: - #ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) { --no_wait_return; EMSG(_("E135: *Filter* Autocommands must not change current buffer")); } - #endif if (itmp != NULL) mch_remove(itmp); if (otmp != NULL) --- 1416,1426 ---- *************** *** 1482,1490 **** * avoid having to type return below. */ msg_putchar('\r'); /* put cursor at start of line */ - #ifdef FEAT_AUTOCMD if (!autocmd_busy) - #endif { #ifdef MSWIN if (!winstart) --- 1470,1476 ---- *************** *** 1497,1507 **** msg_putchar('\n'); /* may shift screen one line up */ /* warning message before calling the shell */ ! if (p_warn ! #ifdef FEAT_AUTOCMD ! && !autocmd_busy ! #endif ! && msg_silent == 0) FOR_ALL_BUFFERS(buf) if (bufIsChangedNotTerm(buf)) { --- 1483,1489 ---- msg_putchar('\n'); /* may shift screen one line up */ /* warning message before calling the shell */ ! if (p_warn && !autocmd_busy && msg_silent == 0) FOR_ALL_BUFFERS(buf) if (bufIsChangedNotTerm(buf)) { *************** *** 1536,1549 **** msg_col = 0; } - #ifdef FEAT_AUTOCMD if (autocmd_busy) { if (msg_silent == 0) redraw_later_clear(); } else - #endif { /* * For ":sh" there is no need to call wait_return(), just redraw. --- 1518,1529 ---- *************** *** 1612,1620 **** /* display any error messages now */ display_errors(); - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf); - #endif } /* --- 1592,1598 ---- *************** *** 2979,2994 **** char_u *fname, *sfname, *xfname; buf_T *buf; - #ifdef FEAT_AUTOCMD buf = curbuf; apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); /* buffer changed, don't change name now */ if (buf != curbuf) return FAIL; ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; - # endif #endif /* * The name of the current buffer will be changed. --- 2957,2970 ---- char_u *fname, *sfname, *xfname; buf_T *buf; buf = curbuf; apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); /* buffer changed, don't change name now */ if (buf != curbuf) return FAIL; ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; #endif /* * The name of the current buffer will be changed. *************** *** 3017,3025 **** } vim_free(fname); vim_free(sfname); - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); ! #endif /* Change directories when the 'acd' option is set. */ DO_AUTOCHDIR return OK; --- 2993,3000 ---- } vim_free(fname); vim_free(sfname); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); ! /* Change directories when the 'acd' option is set. */ DO_AUTOCHDIR return OK; *************** *** 3198,3219 **** { if (eap->cmdidx == CMD_saveas && alt_buf != NULL) { - #ifdef FEAT_AUTOCMD buf_T *was_curbuf = curbuf; apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, alt_buf); ! # ifdef FEAT_EVAL if (curbuf != was_curbuf || aborting()) ! # else if (curbuf != was_curbuf) ! # endif { /* buffer changed, don't change name now */ retval = FAIL; goto theend; } - #endif /* Exchange the file names for the current and the alternate * buffer. This makes it look like we are now editing the buffer * under the new name. Must be done before buf_write(), because --- 3173,3192 ---- { if (eap->cmdidx == CMD_saveas && alt_buf != NULL) { buf_T *was_curbuf = curbuf; apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, alt_buf); ! #ifdef FEAT_EVAL if (curbuf != was_curbuf || aborting()) ! #else if (curbuf != was_curbuf) ! #endif { /* buffer changed, don't change name now */ retval = FAIL; goto theend; } /* Exchange the file names for the current and the alternate * buffer. This makes it look like we are now editing the buffer * under the new name. Must be done before buf_write(), because *************** *** 3229,3235 **** alt_buf->b_sfname = curbuf->b_sfname; curbuf->b_sfname = fname; buf_name_changed(curbuf); ! #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, alt_buf); if (!alt_buf->b_p_bl) --- 3202,3208 ---- alt_buf->b_sfname = curbuf->b_sfname; curbuf->b_sfname = fname; buf_name_changed(curbuf); ! apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, alt_buf); if (!alt_buf->b_p_bl) *************** *** 3237,3247 **** alt_buf->b_p_bl = TRUE; apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, alt_buf); } ! # ifdef FEAT_EVAL if (curbuf != was_curbuf || aborting()) ! # else if (curbuf != was_curbuf) ! # endif { /* buffer changed, don't write the file */ retval = FAIL; --- 3210,3220 ---- alt_buf->b_p_bl = TRUE; apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, alt_buf); } ! #ifdef FEAT_EVAL if (curbuf != was_curbuf || aborting()) ! #else if (curbuf != was_curbuf) ! #endif { /* buffer changed, don't write the file */ retval = FAIL; *************** *** 3260,3266 **** /* Autocommands may have changed buffer names, esp. when * 'autochdir' is set. */ fname = curbuf->b_sfname; - #endif } name_was_missing = curbuf->b_ffname == NULL; --- 3233,3238 ---- *************** *** 3489,3506 **** } else { - #ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); - #endif if (buf_write_all(buf, eap->forceit) == FAIL) ++error; - #ifdef FEAT_AUTOCMD /* an autocommand may have deleted the buffer */ if (!bufref_valid(&bufref)) buf = firstbuf; - #endif } eap->forceit = save_forceit; /* check_overwrite() may set it */ } --- 3461,3474 ---- *************** *** 3604,3613 **** if (text_locked()) return GETFILE_ERROR; - #ifdef FEAT_AUTOCMD if (curbuf_locked()) return GETFILE_ERROR; - #endif if (fnum == 0) { --- 3572,3579 ---- *************** *** 3702,3718 **** { int other_file; /* TRUE if editing another file */ int oldbuf; /* TRUE if using existing buffer */ - #ifdef FEAT_AUTOCMD int auto_buf = FALSE; /* TRUE if autocommands brought us into the buffer unexpectedly */ char_u *new_name = NULL; int did_set_swapcommand = FALSE; #endif buf_T *buf; bufref_T bufref; - #if defined(FEAT_AUTOCMD) || defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) bufref_T old_curbuf; - #endif char_u *free_fname = NULL; #ifdef FEAT_BROWSE char_u *browse_file = NULL; --- 3668,3682 ---- { int other_file; /* TRUE if editing another file */ int oldbuf; /* TRUE if using existing buffer */ int auto_buf = FALSE; /* TRUE if autocommands brought us into the buffer unexpectedly */ char_u *new_name = NULL; + #if defined(FEAT_EVAL) int did_set_swapcommand = FALSE; #endif buf_T *buf; bufref_T bufref; bufref_T old_curbuf; char_u *free_fname = NULL; #ifdef FEAT_BROWSE char_u *browse_file = NULL; *************** *** 3736,3744 **** if (eap != NULL) command = eap->do_ecmd_cmd; - #if defined(FEAT_AUTOCMD) || defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) set_bufref(&old_curbuf, curbuf); - #endif if (fnum != 0) { --- 3700,3706 ---- *************** *** 3751,3761 **** #ifdef FEAT_BROWSE if (cmdmod.browse) { - # ifdef FEAT_AUTOCMD if ( ! # ifdef FEAT_GUI !gui.in_use && ! # endif au_has_group((char_u *)"FileExplorer")) { /* No browsing supported but we do have the file explorer: --- 3713,3722 ---- #ifdef FEAT_BROWSE if (cmdmod.browse) { if ( ! # ifdef FEAT_GUI !gui.in_use && ! # endif au_has_group((char_u *)"FileExplorer")) { /* No browsing supported but we do have the file explorer: *************** *** 3764,3770 **** ffname = (char_u *)"."; } else - # endif { browse_file = do_browse(0, (char_u *)_("Edit File"), ffname, NULL, NULL, NULL, curbuf); --- 3725,3730 ---- *************** *** 3838,3844 **** */ reset_VIsual(); ! #ifdef FEAT_AUTOCMD if ((command != NULL || newlnum > (linenr_T)0) && *get_vim_var_str(VV_SWAPCOMMAND) == NUL) { --- 3798,3804 ---- */ reset_VIsual(); ! #if defined(FEAT_EVAL) if ((command != NULL || newlnum > (linenr_T)0) && *get_vim_var_str(VV_SWAPCOMMAND) == NUL) { *************** *** 3901,3912 **** #endif buf = buflist_new(ffname, sfname, 0L, BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED)); ! #ifdef FEAT_AUTOCMD /* autocommands may change curwin and curbuf */ if (oldwin != NULL) oldwin = curwin; set_bufref(&old_curbuf, curbuf); - #endif } if (buf == NULL) goto theend; --- 3861,3871 ---- #endif buf = buflist_new(ffname, sfname, 0L, BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED)); ! /* autocommands may change curwin and curbuf */ if (oldwin != NULL) oldwin = curwin; set_bufref(&old_curbuf, curbuf); } if (buf == NULL) goto theend; *************** *** 3921,3931 **** (void)buf_check_timestamp(buf, FALSE); /* Check if autocommands made the buffer invalid or changed the * current buffer. */ ! if (!bufref_valid(&bufref) ! #ifdef FEAT_AUTOCMD ! || curbuf != old_curbuf.br_buf ! #endif ! ) goto theend; #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ --- 3880,3886 ---- (void)buf_check_timestamp(buf, FALSE); /* Check if autocommands made the buffer invalid or changed the * current buffer. */ ! if (!bufref_valid(&bufref) || curbuf != old_curbuf.br_buf) goto theend; #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ *************** *** 3950,3956 **** */ if (buf != curbuf) { - #ifdef FEAT_AUTOCMD /* * Be careful: The autocommands may delete any buffer and change * the current buffer. --- 3905,3910 ---- *************** *** 3971,3983 **** delbuf_msg(new_name); /* frees new_name */ goto theend; } ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ { vim_free(new_name); goto theend; } ! # endif if (buf == curbuf) /* already in new buffer */ auto_buf = TRUE; else --- 3925,3937 ---- delbuf_msg(new_name); /* frees new_name */ goto theend; } ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ { vim_free(new_name); goto theend; } ! #endif if (buf == curbuf) /* already in new buffer */ auto_buf = TRUE; else *************** *** 3990,3996 **** ++buf->b_locked; if (curbuf == old_curbuf.br_buf) - #endif buf_copy_options(buf, BCO_ENTER); /* Close the link to the current buffer. This will set --- 3944,3949 ---- *************** *** 3999,4016 **** close_buffer(oldwin, curbuf, (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE); - #ifdef FEAT_AUTOCMD the_curwin->w_closing = FALSE; --buf->b_locked; ! # ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting() && curwin->w_buffer != NULL) { vim_free(new_name); goto theend; } ! # endif /* Be careful again, like above. */ if (!bufref_valid(&au_new_curbuf)) { --- 3952,3968 ---- close_buffer(oldwin, curbuf, (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE); the_curwin->w_closing = FALSE; --buf->b_locked; ! #ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting() && curwin->w_buffer != NULL) { vim_free(new_name); goto theend; } ! #endif /* Be careful again, like above. */ if (!bufref_valid(&au_new_curbuf)) { *************** *** 4021,4027 **** if (buf == curbuf) /* already in new buffer */ auto_buf = TRUE; else - #endif { #ifdef FEAT_SYN_HL /* --- 3973,3978 ---- *************** *** 4054,4066 **** #ifdef FEAT_SPELL did_get_winopts = TRUE; #endif - - #ifdef FEAT_AUTOCMD } vim_free(new_name); au_new_curbuf.br_buf = NULL; au_new_curbuf.br_buf_free_count = 0; - #endif } curwin->w_pcmark.lnum = 1; --- 4005,4014 ---- *************** *** 4083,4091 **** ++RedrawingDisabled; did_inc_redrawing_disabled = TRUE; - #ifdef FEAT_AUTOCMD buf = curbuf; - #endif if ((flags & ECMD_SET_HELP) || keep_help_flag) { prepare_help_buffer(); --- 4031,4037 ---- *************** *** 4098,4118 **** set_buflisted(TRUE); } - #ifdef FEAT_AUTOCMD /* If autocommands change buffers under our fingers, forget about * editing the file. */ if (buf != curbuf) goto theend; ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ goto theend; ! # endif /* Since we are starting to edit a file, consider the filetype to be * unset. Helps for when an autocommand changes files and expects syntax * highlighting to work in the other file. */ did_filetype = FALSE; - #endif /* * other_file oldbuf --- 4044,4062 ---- set_buflisted(TRUE); } /* If autocommands change buffers under our fingers, forget about * editing the file. */ if (buf != curbuf) goto theend; ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ goto theend; ! #endif /* Since we are starting to edit a file, consider the filetype to be * unset. Helps for when an autocommand changes files and expects syntax * highlighting to work in the other file. */ did_filetype = FALSE; /* * other_file oldbuf *************** *** 4129,4142 **** newlnum = curwin->w_cursor.lnum; solcol = curwin->w_cursor.col; } - #ifdef FEAT_AUTOCMD buf = curbuf; if (buf->b_fname != NULL) new_name = vim_strsave(buf->b_fname); else new_name = NULL; set_bufref(&bufref, buf); ! #endif if (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur) { /* Save all the text, so that the reload can be undone. --- 4073,4085 ---- newlnum = curwin->w_cursor.lnum; solcol = curwin->w_cursor.col; } buf = curbuf; if (buf->b_fname != NULL) new_name = vim_strsave(buf->b_fname); else new_name = NULL; set_bufref(&bufref, buf); ! if (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur) { /* Save all the text, so that the reload can be undone. *************** *** 4145,4153 **** if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE) == FAIL) { - #ifdef FEAT_AUTOCMD vim_free(new_name); - #endif goto theend; } u_unchanged(curbuf); --- 4088,4094 ---- *************** *** 4158,4164 **** } else buf_freeall(curbuf, 0); /* free all things for buffer */ ! #ifdef FEAT_AUTOCMD /* If autocommands deleted the buffer we were going to re-edit, give * up and jump to the end. */ if (!bufref_valid(&bufref)) --- 4099,4105 ---- } else buf_freeall(curbuf, 0); /* free all things for buffer */ ! /* If autocommands deleted the buffer we were going to re-edit, give * up and jump to the end. */ if (!bufref_valid(&bufref)) *************** *** 4173,4182 **** * the autocommands changed the buffer... */ if (buf != curbuf) goto theend; ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ goto theend; - # endif #endif buf_clear_file(curbuf); curbuf->b_op_start.lnum = 0; /* clear '[ and '] marks */ --- 4114,4122 ---- * the autocommands changed the buffer... */ if (buf != curbuf) goto theend; ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ goto theend; #endif buf_clear_file(curbuf); curbuf->b_op_start.lnum = 0; /* clear '[ and '] marks */ *************** *** 4194,4202 **** */ check_arg_idx(curwin); - #ifdef FEAT_AUTOCMD if (!auto_buf) - #endif { /* * Set cursor and init window before reading the file and executing --- 4134,4140 ---- *************** *** 4237,4243 **** /* * Open the buffer and read the file. */ ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (should_abort(open_buffer(FALSE, eap, readfile_flags))) retval = FAIL; #else --- 4175,4181 ---- /* * Open the buffer and read the file. */ ! #if defined(FEAT_EVAL) if (should_abort(open_buffer(FALSE, eap, readfile_flags))) retval = FAIL; #else *************** *** 4250,4256 **** handle_swap_exists(&old_curbuf); #endif } - #ifdef FEAT_AUTOCMD else { /* Read the modelines, but only to set window-local options. Any --- 4188,4193 ---- *************** *** 4264,4270 **** &retval); } check_arg_idx(curwin); - #endif /* If autocommands change the cursor position or topline, we should * keep it. Also when it moves within a line. */ --- 4201,4206 ---- *************** *** 4342,4352 **** * Did not read the file, need to show some info about the file. * Do this after setting the cursor. */ ! if (oldbuf ! #ifdef FEAT_AUTOCMD ! && !auto_buf ! #endif ! ) { int msg_scroll_save = msg_scroll; --- 4278,4284 ---- * Did not read the file, need to show some info about the file. * Do this after setting the cursor. */ ! if (oldbuf && !auto_buf) { int msg_scroll_save = msg_scroll; *************** *** 4430,4436 **** theend: if (did_inc_redrawing_disabled) --RedrawingDisabled; ! #ifdef FEAT_AUTOCMD if (did_set_swapcommand) set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); #endif --- 4362,4368 ---- theend: if (did_inc_redrawing_disabled) --RedrawingDisabled; ! #if defined(FEAT_EVAL) if (did_set_swapcommand) set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); #endif *************** *** 4441,4447 **** return retval; } - #ifdef FEAT_AUTOCMD static void delbuf_msg(char_u *name) { --- 4373,4378 ---- *************** *** 4451,4457 **** au_new_curbuf.br_buf = NULL; au_new_curbuf.br_buf_free_count = 0; } - #endif static int append_indent = 0; /* autoindent for first line */ --- 4382,4387 ---- *************** *** 5156,5162 **** */ line2 = eap->line2; for (lnum = eap->line1; lnum <= line2 && !(got_quit ! #if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD) || aborting() #endif ); ++lnum) --- 5086,5092 ---- */ line2 = eap->line2; for (lnum = eap->line1; lnum <= line2 && !(got_quit ! #if defined(FEAT_EVAL) || aborting() #endif ); ++lnum) *************** *** 6870,6876 **** char_u *rt; int mustfree; - #ifdef FEAT_AUTOCMD /* Set filetype to "help" if still needed. */ if (STRCMP(curbuf->b_p_ft, "help") != 0) { --- 6800,6805 ---- *************** *** 6878,6884 **** set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL); --curbuf_lock; } - #endif #ifdef FEAT_SYN_HL if (!syntax_present(curwin)) --- 6807,6812 ---- *** ../vim-8.0.1563/src/ex_cmds2.c 2018-02-19 23:09:57.385619337 +0100 --- src/ex_cmds2.c 2018-03-04 15:53:28.983602715 +0100 *************** *** 2045,2061 **** FOR_ALL_BUFFERS(buf) if (bufIsChanged(buf) && !buf->b_p_ro) { - #ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); ! #endif (void)buf_write_all(buf, FALSE); ! #ifdef FEAT_AUTOCMD /* an autocommand may have deleted the buffer */ if (!bufref_valid(&bufref)) buf = firstbuf; - #endif } } --- 2045,2059 ---- FOR_ALL_BUFFERS(buf) if (bufIsChanged(buf) && !buf->b_p_ro) { bufref_T bufref; set_bufref(&bufref, buf); ! (void)buf_write_all(buf, FALSE); ! /* an autocommand may have deleted the buffer */ if (!bufref_valid(&bufref)) buf = firstbuf; } } *************** *** 2067,2077 **** check_changed(buf_T *buf, int flags) { int forceit = (flags & CCGD_FORCEIT); - #ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); - #endif if ( !forceit && bufIsChanged(buf) --- 2065,2073 ---- *************** *** 2093,2109 **** # endif )) ++count; - # ifdef FEAT_AUTOCMD if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed now. */ return FALSE; ! # endif dialog_changed(buf, count > 1); ! # ifdef FEAT_AUTOCMD if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed now. */ return FALSE; - # endif return bufIsChanged(buf); } #endif --- 2089,2103 ---- # endif )) ++count; if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed now. */ return FALSE; ! dialog_changed(buf, count > 1); ! if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed now. */ return FALSE; return bufIsChanged(buf); } #endif *************** *** 2197,2207 **** ) && !buf2->b_p_ro) { - #ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf2); - #endif #ifdef FEAT_BROWSE /* May get file name, when there is none */ browse_save_fname(buf2); --- 2191,2199 ---- *************** *** 2210,2220 **** buf2->b_fname, buf2->b_ffname, FALSE) == OK) /* didn't hit Cancel */ (void)buf_write_all(buf2, FALSE); ! #ifdef FEAT_AUTOCMD /* an autocommand may have deleted the buffer */ if (!bufref_valid(&bufref)) buf2 = firstbuf; - #endif } } } --- 2202,2211 ---- buf2->b_fname, buf2->b_ffname, FALSE) == OK) /* didn't hit Cancel */ (void)buf_write_all(buf2, FALSE); ! /* an autocommand may have deleted the buffer */ if (!bufref_valid(&bufref)) buf2 = firstbuf; } } } *************** *** 2370,2388 **** FOR_ALL_TAB_WINDOWS(tp, wp) if (wp->w_buffer == buf) { - #ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); ! #endif goto_tabpage_win(tp, wp); ! #ifdef FEAT_AUTOCMD /* Paranoia: did autocms wipe out the buffer with changes? */ if (!bufref_valid(&bufref)) - { goto theend; - } - #endif goto buf_found; } buf_found: --- 2361,2375 ---- FOR_ALL_TAB_WINDOWS(tp, wp) if (wp->w_buffer == buf) { bufref_T bufref; set_bufref(&bufref, buf); ! goto_tabpage_win(tp, wp); ! /* Paranoia: did autocms wipe out the buffer with changes? */ if (!bufref_valid(&bufref)) goto theend; goto buf_found; } buf_found: *************** *** 2420,2439 **** buf_write_all(buf_T *buf, int forceit) { int retval; - #ifdef FEAT_AUTOCMD buf_T *old_curbuf = curbuf; - #endif retval = (buf_write(buf, buf->b_ffname, buf->b_fname, (linenr_T)1, buf->b_ml.ml_line_count, NULL, FALSE, forceit, TRUE, FALSE)); - #ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) { msg_source(HL_ATTR(HLF_W)); MSG(_("Warning: Entered other buffer unexpectedly (check autocommands)")); } - #endif return retval; } --- 2407,2422 ---- *************** *** 3053,3059 **** tabpage_T *tp; buf_T *buf = curbuf; int next_fnum = 0; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) char_u *save_ei = NULL; #endif char_u *p_shm_save; --- 3036,3042 ---- tabpage_T *tp; buf_T *buf = curbuf; int next_fnum = 0; ! #if defined(FEAT_SYN_HL) char_u *save_ei = NULL; #endif char_u *p_shm_save; *************** *** 3071,3077 **** } #endif ! #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo) /* Don't do syntax HL autocommands. Skipping the syntax file is a * great speed improvement. */ --- 3054,3060 ---- } #endif ! #if defined(FEAT_SYN_HL) if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo) /* Don't do syntax HL autocommands. Skipping the syntax file is a * great speed improvement. */ *************** *** 3265,3271 **** listcmd_busy = FALSE; } ! #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) if (save_ei != NULL) { au_event_restore(save_ei); --- 3248,3254 ---- listcmd_busy = FALSE; } ! #if defined(FEAT_SYN_HL) if (save_ei != NULL) { au_event_restore(save_ei); *************** *** 3660,3665 **** --- 3643,3650 ---- } + #if defined(FEAT_EVAL) || defined(PROTO) + /* * Expand wildcards in "pat" and invoke do_source() for each match. */ *************** *** 3800,3806 **** vim_snprintf((char *)pat, len, plugpat, ffname); source_all_matches(pat); - #ifdef FEAT_AUTOCMD { char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes"); --- 3785,3790 ---- *************** *** 3815,3821 **** } vim_free(cmd); } - #endif vim_free(pat); retval = OK; --- 3799,3804 ---- *************** *** 3911,3918 **** vim_free(pat); } } ! #if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD) /* * ":options" */ --- 3894,3902 ---- vim_free(pat); } } + #endif ! #if defined(FEAT_EVAL) || defined(PROTO) /* * ":options" */ *************** *** 4308,4330 **** goto theend; } - #ifdef FEAT_AUTOCMD /* Apply SourceCmd autocommands, they should get the file and source it. */ if (has_autocmd(EVENT_SOURCECMD, fname_exp, NULL) && apply_autocmds(EVENT_SOURCECMD, fname_exp, fname_exp, FALSE, curbuf)) { ! # ifdef FEAT_EVAL retval = aborting() ? FAIL : OK; ! # else retval = OK; ! # endif goto theend; } /* Apply SourcePre autocommands, they may get the file. */ apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf); - #endif #ifdef USE_FOPEN_NOINH cookie.fp = fopen_noinh_readbin((char *)fname_exp); --- 4292,4312 ---- goto theend; } /* Apply SourceCmd autocommands, they should get the file and source it. */ if (has_autocmd(EVENT_SOURCECMD, fname_exp, NULL) && apply_autocmds(EVENT_SOURCECMD, fname_exp, fname_exp, FALSE, curbuf)) { ! #ifdef FEAT_EVAL retval = aborting() ? FAIL : OK; ! #else retval = OK; ! #endif goto theend; } /* Apply SourcePre autocommands, they may get the file. */ apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf); #ifdef USE_FOPEN_NOINH cookie.fp = fopen_noinh_readbin((char *)fname_exp); *** ../vim-8.0.1563/src/ex_docmd.c 2018-02-13 18:05:14.080439478 +0100 --- src/ex_docmd.c 2018-03-04 15:58:14.941787912 +0100 *************** *** 81,94 **** # define ex_menu ex_ni # define ex_menutranslate ex_ni #endif - #ifdef FEAT_AUTOCMD static void ex_autocmd(exarg_T *eap); static void ex_doautocmd(exarg_T *eap); - #else - # define ex_autocmd ex_ni - # define ex_doautocmd ex_ni - # define ex_doautoall ex_ni - #endif #ifdef FEAT_LISTCMDS static void ex_bunload(exarg_T *eap); static void ex_buffer(exarg_T *eap); --- 81,88 ---- *************** *** 234,239 **** --- 228,237 ---- # define ex_syntax ex_ni # define ex_ownsyntax ex_ni #endif + #ifndef FEAT_EVAL + # define ex_packadd ex_ni + # define ex_packloadall ex_ni + #endif #if !defined(FEAT_SYN_HL) || !defined(FEAT_PROFILE) # define ex_syntime ex_ni #endif *************** *** 390,402 **** # define ex_viminfo ex_ni #endif static void ex_behave(exarg_T *eap); - #ifdef FEAT_AUTOCMD static void ex_filetype(exarg_T *eap); static void ex_setfiletype(exarg_T *eap); - #else - # define ex_filetype ex_ni - # define ex_setfiletype ex_ni - #endif #ifndef FEAT_DIFF # define ex_diffoff ex_ni # define ex_diffpatch ex_ni --- 388,395 ---- *************** *** 407,413 **** #endif static void ex_digraphs(exarg_T *eap); static void ex_set(exarg_T *eap); ! #if !defined(FEAT_EVAL) || !defined(FEAT_AUTOCMD) # define ex_options ex_ni #endif #ifdef FEAT_SEARCH_EXTRA --- 400,406 ---- #endif static void ex_digraphs(exarg_T *eap); static void ex_set(exarg_T *eap); ! #if !defined(FEAT_EVAL) # define ex_options ex_ni #endif #ifdef FEAT_SEARCH_EXTRA *************** *** 1761,1771 **** /* avoid that a function call in 'statusline' does this */ && !getline_equal(fgetline, cookie, get_func_line) #endif - #ifdef FEAT_AUTOCMD /* avoid that an autocommand, e.g. QuitPre, does this */ ! && !getline_equal(fgetline, cookie, getnextac) ! #endif ! ) --quitmore; /* --- 1754,1761 ---- /* avoid that a function call in 'statusline' does this */ && !getline_equal(fgetline, cookie, get_func_line) #endif /* avoid that an autocommand, e.g. QuitPre, does this */ ! && !getline_equal(fgetline, cookie, getnextac)) --quitmore; /* *************** *** 1912,1918 **** case 'n': if (checkforcmd(&ea.cmd, "noautocmd", 3)) { - #ifdef FEAT_AUTOCMD if (cmdmod.save_ei == NULL) { /* Set 'eventignore' to "all". Restore the --- 1902,1907 ---- *************** *** 1921,1927 **** set_string_option_direct((char_u *)"ei", -1, (char_u *)"all", OPT_FREE, SID_NONE); } - #endif continue; } if (!checkforcmd(&ea.cmd, "noswapfile", 3)) --- 1910,1915 ---- *************** *** 2302,2308 **** goto doend; } - #ifdef FEAT_AUTOCMD /* If this looks like an undefined user command and there are CmdUndefined * autocommands defined, trigger the matching autocommands. */ if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip --- 2290,2295 ---- *************** *** 2319,2327 **** vim_free(p); /* If the autocommands did something and didn't cause an error, try * finding the command again. */ ! p = (ret && !aborting()) ? find_command(&ea, NULL) : ea.cmd; ! } #endif #ifdef FEAT_USR_CMDS if (p == NULL) --- 2306,2317 ---- vim_free(p); /* If the autocommands did something and didn't cause an error, try * finding the command again. */ ! p = (ret ! #ifdef FEAT_EVAL ! && !aborting() #endif + ) ? find_command(&ea, NULL) : ea.cmd; + } #ifdef FEAT_USR_CMDS if (p == NULL) *************** *** 2421,2427 **** errormsg = (char_u *)_(get_text_locked_msg()); goto doend; } - #ifdef FEAT_AUTOCMD /* Disallow editing another buffer when "curbuf_lock" is set. * Do allow ":edit" (check for argument later). * Do allow ":checktime" (it's postponed). */ --- 2411,2416 ---- *************** *** 2431,2437 **** && !IS_USER_CMDIDX(ea.cmdidx) && curbuf_locked()) goto doend; - #endif if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0) { --- 2420,2425 ---- *************** *** 2971,2977 **** if (verbose_save >= 0) p_verbose = verbose_save; ! #ifdef FEAT_AUTOCMD if (cmdmod.save_ei != NULL) { /* Restore 'eventignore' to the value before ":noautocmd". */ --- 2959,2965 ---- if (verbose_save >= 0) p_verbose = verbose_save; ! if (cmdmod.save_ei != NULL) { /* Restore 'eventignore' to the value before ":noautocmd". */ *************** *** 2979,2985 **** OPT_FREE, SID_NONE); free_string_option(cmdmod.save_ei); } ! #endif if (cmdmod.filter_regmatch.regprog != NULL) vim_regfree(cmdmod.filter_regmatch.regprog); --- 2967,2973 ---- OPT_FREE, SID_NONE); free_string_option(cmdmod.save_ei); } ! if (cmdmod.filter_regmatch.regprog != NULL) vim_regfree(cmdmod.filter_regmatch.regprog); *************** *** 4025,4038 **** } } break; ! #ifdef FEAT_AUTOCMD case CMD_autocmd: return set_context_in_autocmd(xp, arg, FALSE); - case CMD_doautocmd: case CMD_doautoall: return set_context_in_autocmd(xp, arg, TRUE); - #endif case CMD_set: set_context_in_set_cmd(xp, arg, 0); break; --- 4013,4024 ---- } } break; ! case CMD_autocmd: return set_context_in_autocmd(xp, arg, FALSE); case CMD_doautocmd: case CMD_doautoall: return set_context_in_autocmd(xp, arg, TRUE); case CMD_set: set_context_in_set_cmd(xp, arg, 0); break; *************** *** 5500,5506 **** map_clear(eap->cmd, eap->arg, TRUE, TRUE); } - #if defined(FEAT_AUTOCMD) || defined(PROTO) static void ex_autocmd(exarg_T *eap) { --- 5486,5491 ---- *************** *** 5534,5540 **** if (call_do_modelines && did_aucmd) do_modelines(0); } - #endif #ifdef FEAT_LISTCMDS /* --- 5519,5524 ---- *************** *** 7234,7240 **** else wp = curwin; - #ifdef FEAT_AUTOCMD /* Refuse to quit when locked. */ if (curbuf_locked()) return; --- 7218,7223 ---- *************** *** 7245,7251 **** if (!win_valid(wp) || (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0)) return; - #endif #ifdef FEAT_NETBEANS_INTG netbeansForcedQuit = eap->forceit; --- 7228,7233 ---- *************** *** 7318,7330 **** text_locked_msg(); return; } - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); /* Refuse to quit when locked or when the buffer in the last window is * being closed (can only happen in autocommands). */ if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) return; - #endif exiting = TRUE; if (eap->forceit || !check_changed_any(FALSE, FALSE)) --- 7300,7310 ---- *************** *** 7345,7355 **** cmdwin_result = Ctrl_C; else #endif ! if (!text_locked() ! #ifdef FEAT_AUTOCMD ! && !curbuf_locked() ! #endif ! ) { if (eap->addr_count == 0) ex_win_close(eap->forceit, curwin, NULL); --- 7325,7331 ---- cmdwin_result = Ctrl_C; else #endif ! if (!text_locked() && !curbuf_locked()) { if (eap->addr_count == 0) ex_win_close(eap->forceit, curwin, NULL); *************** *** 7565,7575 **** tabpage_close_other(tp, eap->forceit); return; } ! else if (!text_locked() ! #ifdef FEAT_AUTOCMD ! && !curbuf_locked() ! #endif ! ) tabpage_close(eap->forceit); } } --- 7541,7547 ---- tabpage_close_other(tp, eap->forceit); return; } ! else if (!text_locked() && !curbuf_locked()) tabpage_close(eap->forceit); } } *************** *** 7662,7670 **** break; } - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); - #endif redraw_tabline = TRUE; if (h != tabline_height()) --- 7634,7640 ---- *************** *** 7790,7802 **** text_locked_msg(); return; } - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); /* Refuse to quit when locked or when the buffer in the last window is * being closed (can only happen in autocommands). */ if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) return; - #endif /* * if more files or windows we won't exit --- 7760,7770 ---- *************** *** 7901,7910 **** /* Postpone this while editing the command line. */ if (text_locked()) return; - #ifdef FEAT_AUTOCMD if (curbuf_locked()) return; ! #endif /* When the screen is being updated we should not change buffers and * windows structures, it may cause freed memory to be used. */ if (updating_screen) --- 7869,7877 ---- /* Postpone this while editing the command line. */ if (text_locked()) return; if (curbuf_locked()) return; ! /* When the screen is being updated we should not change buffers and * windows structures, it may cause freed memory to be used. */ if (updating_screen) *************** *** 8072,8080 **** if (recursive) { - #ifdef FEAT_AUTOCMD EMSG(_(e_au_recursive)); - #endif return; } ++recursive; --- 8039,8045 ---- *************** *** 8251,8261 **** && eap->cmdidx != CMD_vnew && eap->cmdidx != CMD_new) { - # ifdef FEAT_AUTOCMD if ( ! # ifdef FEAT_GUI !gui.in_use && ! # endif au_has_group((char_u *)"FileExplorer")) { /* No browsing supported but we do have the file explorer: --- 8216,8225 ---- && eap->cmdidx != CMD_vnew && eap->cmdidx != CMD_new) { if ( ! # ifdef FEAT_GUI !gui.in_use && ! # endif au_has_group((char_u *)"FileExplorer")) { /* No browsing supported but we do have the file explorer: *************** *** 8264,8270 **** eap->arg = (char_u *)"."; } else - # endif { fname = do_browse(0, (char_u *)_("Edit File in new window"), eap->arg, NULL, NULL, NULL, curbuf); --- 8228,8233 ---- *************** *** 8668,8679 **** #endif ) { - #ifdef FEAT_AUTOCMD /* Can't edit another file when "curbuf_lock" is set. Only ":edit" * can bring us here, others are stopped earlier. */ if (*eap->arg != NUL && curbuf_locked()) return; ! #endif n = readonlymode; if (eap->cmdidx == CMD_view || eap->cmdidx == CMD_sview) readonlymode = TRUE; --- 8631,8641 ---- #endif ) { /* Can't edit another file when "curbuf_lock" is set. Only ":edit" * can bring us here, others are stopped earlier. */ if (*eap->arg != NUL && curbuf_locked()) return; ! n = readonlymode; if (eap->cmdidx == CMD_view || eap->cmdidx == CMD_sview) readonlymode = TRUE; *************** *** 8702,8708 **** need_hide = (curbufIsChanged() && curbuf->b_nwindows <= 1); if (!need_hide || buf_hide(curbuf)) { ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that --- 8664,8670 ---- need_hide = (curbufIsChanged() && curbuf->b_nwindows <= 1); if (!need_hide || buf_hide(curbuf)) { ! #if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that *************** *** 8714,8720 **** #endif win_close(curwin, !need_hide && !buf_hide(curbuf)); ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not * discarded by a new aborting error, interrupt, or * uncaught exception. */ --- 8676,8682 ---- #endif win_close(curwin, !need_hide && !buf_hide(curbuf)); ! #if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not * discarded by a new aborting error, interrupt, or * uncaught exception. */ *************** *** 8927,8933 **** } if (i != OK) { ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (!aborting()) #endif EMSG2(_(e_notopen), eap->arg); --- 8889,8895 ---- } if (i != OK) { ! #if defined(FEAT_EVAL) if (!aborting()) #endif EMSG2(_(e_notopen), eap->arg); *************** *** 9013,9022 **** else #endif { - #ifdef FEAT_AUTOCMD if (allbuf_locked()) return; - #endif if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() && !eap->forceit) { --- 8975,8982 ---- *************** *** 9073,9083 **** /* Echo the new current directory if the command was typed. */ if (KeyTyped || p_verbose >= 5) ex_pwd(eap); - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_DIRCHANGED, is_local_chdir ? (char_u *)"window" : (char_u *)"global", new_dir, FALSE, curbuf); - #endif } vim_free(tofree); } --- 9033,9041 ---- *************** *** 10588,10608 **** #define SPEC_SFILE (SPEC_CFILE + 1) "", /* ":so" file line number */ #define SPEC_SLNUM (SPEC_SFILE + 1) - #ifdef FEAT_AUTOCMD "", /* autocommand file name */ ! # define SPEC_AFILE (SPEC_SLNUM + 1) "", /* autocommand buffer number */ ! # define SPEC_ABUF (SPEC_AFILE + 1) "", /* autocommand match name */ ! # define SPEC_AMATCH (SPEC_ABUF + 1) ! #endif #ifdef FEAT_CLIENTSERVER "" ! # ifdef FEAT_AUTOCMD ! # define SPEC_CLIENT (SPEC_AMATCH + 1) ! # else ! # define SPEC_CLIENT (SPEC_SLNUM + 1) ! # endif #endif }; --- 10546,10560 ---- #define SPEC_SFILE (SPEC_CFILE + 1) "", /* ":so" file line number */ #define SPEC_SLNUM (SPEC_SFILE + 1) "", /* autocommand file name */ ! #define SPEC_AFILE (SPEC_SLNUM + 1) "", /* autocommand buffer number */ ! #define SPEC_ABUF (SPEC_AFILE + 1) "", /* autocommand match name */ ! #define SPEC_AMATCH (SPEC_ABUF + 1) #ifdef FEAT_CLIENTSERVER "" ! # define SPEC_CLIENT (SPEC_AMATCH + 1) #endif }; *************** *** 10801,10807 **** break; #endif - #ifdef FEAT_AUTOCMD case SPEC_AFILE: /* file name for autocommand */ result = autocmd_fname; if (result != NULL && !autocmd_fname_full) --- 10753,10758 ---- *************** *** 10840,10846 **** } break; - #endif case SPEC_SFILE: /* file name for ":so" command */ result = sourcing_name; if (result == NULL) --- 10791,10796 ---- *************** *** 10976,10982 **** return retval; } - #if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Expand the string in "arg". * --- 10926,10931 ---- *************** *** 11038,11044 **** return result; } - #endif #ifdef FEAT_SESSION static int ses_winsizes(FILE *fd, int restore_size, --- 10987,10992 ---- *************** *** 12070,12076 **** return NULL; } - #ifdef FEAT_AUTOCMD static int filetype_detect = FALSE; static int filetype_plugin = FALSE; static int filetype_indent = FALSE; --- 12018,12023 ---- *************** *** 12184,12190 **** did_filetype = FALSE; } } - #endif static void ex_digraphs(exarg_T *eap UNUSED) --- 12131,12136 ---- *************** *** 12208,12214 **** flags = OPT_LOCAL; else if (eap->cmdidx == CMD_setglobal) flags = OPT_GLOBAL; ! #if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD) && defined(FEAT_BROWSE) if (cmdmod.browse && flags == 0) ex_options(eap); else --- 12154,12160 ---- flags = OPT_LOCAL; else if (eap->cmdidx == CMD_setglobal) flags = OPT_GLOBAL; ! #if defined(FEAT_EVAL) && defined(FEAT_BROWSE) if (cmdmod.browse && flags == 0) ex_options(eap); else *** ../vim-8.0.1563/src/ex_getln.c 2018-02-11 15:20:16.298274009 +0100 --- src/ex_getln.c 2018-03-04 16:51:48.769066570 +0100 *************** *** 146,152 **** #endif - #ifdef FEAT_AUTOCMD static void trigger_cmd_autocmd(int typechar, int evt) { --- 146,151 ---- *************** *** 156,162 **** typestr[1] = NUL; apply_autocmds(evt, typestr, typestr, FALSE, curbuf); } - #endif /* * Abandon the command line. --- 155,160 ---- *************** *** 266,274 **** * custom status line may invoke ":normal". */ struct cmdline_info save_ccline; #endif - #ifdef FEAT_AUTOCMD int cmdline_type; - #endif #ifdef FEAT_EVAL if (firstc == -1) --- 264,270 ---- *************** *** 376,386 **** b_im_ptr = &curbuf->b_p_imsearch; if (*b_im_ptr == B_IMODE_LMAP) State |= LANGMAP; ! #ifdef FEAT_MBYTE im_set_active(*b_im_ptr == B_IMODE_IM); #endif } ! #ifdef FEAT_MBYTE else if (p_imcmdline) im_set_active(TRUE); #endif --- 372,382 ---- b_im_ptr = &curbuf->b_p_imsearch; if (*b_im_ptr == B_IMODE_LMAP) State |= LANGMAP; ! #ifdef HAVE_INPUT_METHOD im_set_active(*b_im_ptr == B_IMODE_IM); #endif } ! #ifdef HAVE_INPUT_METHOD else if (p_imcmdline) im_set_active(TRUE); #endif *************** *** 396,406 **** * terminal mode set to cooked. Need to set raw mode here then. */ settmode(TMODE_RAW); - #ifdef FEAT_AUTOCMD /* Trigger CmdlineEnter autocommands. */ cmdline_type = firstc == NUL ? '-' : firstc; trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINEENTER); - #endif #ifdef FEAT_CMDHIST init_history(); --- 392,400 ---- *************** *** 1132,1138 **** { /* ":lmap" mappings exists, toggle use of mappings. */ State ^= LANGMAP; ! #ifdef FEAT_MBYTE im_set_active(FALSE); /* Disable input method */ #endif if (b_im_ptr != NULL) --- 1126,1132 ---- { /* ":lmap" mappings exists, toggle use of mappings. */ State ^= LANGMAP; ! #ifdef HAVE_INPUT_METHOD im_set_active(FALSE); /* Disable input method */ #endif if (b_im_ptr != NULL) *************** *** 1143,1149 **** *b_im_ptr = B_IMODE_NONE; } } ! #ifdef FEAT_MBYTE else { /* There are no ":lmap" mappings, toggle IM. When --- 1137,1143 ---- *b_im_ptr = B_IMODE_NONE; } } ! #ifdef HAVE_INPUT_METHOD else { /* There are no ":lmap" mappings, toggle IM. When *************** *** 1946,1955 **** #endif cmdline_changed: - #ifdef FEAT_AUTOCMD /* Trigger CmdlineChanged autocommands. */ trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED); - #endif #ifdef FEAT_SEARCH_EXTRA /* --- 1940,1947 ---- *************** *** 2160,2172 **** if (some_key_typed) need_wait_return = FALSE; - #ifdef FEAT_AUTOCMD /* Trigger CmdlineLeave autocommands. */ trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVE); - #endif State = save_State; ! #ifdef FEAT_MBYTE if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP) im_save_status(b_im_ptr); im_set_active(FALSE); --- 2152,2162 ---- if (some_key_typed) need_wait_return = FALSE; /* Trigger CmdlineLeave autocommands. */ trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVE); State = save_State; ! #ifdef HAVE_INPUT_METHOD if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP) im_save_status(b_im_ptr); im_set_active(FALSE); *************** *** 2266,2272 **** return e_secure; } - #if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is * and give an error message. --- 2256,2261 ---- *************** *** 2296,2302 **** } return FALSE; } - #endif static int cmdline_charsize(int idx) --- 2285,2290 ---- *************** *** 4983,4992 **** {EXPAND_SYNTIME, get_syntime_arg, TRUE, TRUE}, #endif {EXPAND_HIGHLIGHT, get_highlight_name, TRUE, TRUE}, - #ifdef FEAT_AUTOCMD {EXPAND_EVENTS, get_event_name, TRUE, TRUE}, {EXPAND_AUGROUP, get_augroup_name, TRUE, TRUE}, - #endif #ifdef FEAT_CSCOPE {EXPAND_CSCOPE, get_cscope_name, TRUE, TRUE}, #endif --- 4971,4978 ---- *************** *** 6930,6939 **** /* Save current window sizes. */ win_size_save(&winsizes); - # ifdef FEAT_AUTOCMD /* Don't execute autocommands while creating the window. */ block_autocmds(); ! # endif /* don't use a new tab page */ cmdmod.tab = 0; cmdmod.noswapfile = 1; --- 6916,6924 ---- /* Save current window sizes. */ win_size_save(&winsizes); /* Don't execute autocommands while creating the window. */ block_autocmds(); ! /* don't use a new tab page */ cmdmod.tab = 0; cmdmod.noswapfile = 1; *************** *** 6942,6950 **** if (win_split((int)p_cwh, WSP_BOT) == FAIL) { beep_flush(); - # ifdef FEAT_AUTOCMD unblock_autocmds(); - # endif return K_IGNORE; } cmdwin_type = get_cmdline_type(); --- 6927,6933 ---- *************** *** 6963,6974 **** # endif RESET_BINDING(curwin); - # ifdef FEAT_AUTOCMD /* Do execute autocommands for setting the filetype (load syntax). */ unblock_autocmds(); /* But don't allow switching to another buffer. */ ++curbuf_lock; - # endif /* Showing the prompt may have set need_wait_return, reset it. */ need_wait_return = FALSE; --- 6946,6955 ---- *************** *** 6983,6991 **** } set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL); } - # ifdef FEAT_AUTOCMD --curbuf_lock; - # endif /* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin * sets 'textwidth' to 78). */ --- 6964,6970 ---- *************** *** 7031,7042 **** setmouse(); # endif - # ifdef FEAT_AUTOCMD /* Trigger CmdwinEnter autocommands. */ trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER); if (restart_edit != 0) /* autocmd with ":startinsert" */ stuffcharReadbuff(K_NOP); - # endif i = RedrawingDisabled; RedrawingDisabled = 0; --- 7010,7019 ---- *************** *** 7049,7068 **** RedrawingDisabled = i; ! # ifdef FEAT_AUTOCMD ! ! # ifdef FEAT_FOLDING save_KeyTyped = KeyTyped; ! # endif /* Trigger CmdwinLeave autocommands. */ trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINLEAVE); ! # ifdef FEAT_FOLDING /* Restore KeyTyped in case it is modified by autocommands */ KeyTyped = save_KeyTyped; - # endif - # endif /* Restore the command line info. */ --- 7026,7041 ---- RedrawingDisabled = i; ! # ifdef FEAT_FOLDING save_KeyTyped = KeyTyped; ! # endif /* Trigger CmdwinLeave autocommands. */ trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINLEAVE); ! # ifdef FEAT_FOLDING /* Restore KeyTyped in case it is modified by autocommands */ KeyTyped = save_KeyTyped; # endif /* Restore the command line info. */ *************** *** 7080,7086 **** } else { ! # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* autocmds may abort script processing */ if (aborting() && cmdwin_result != K_IGNORE) cmdwin_result = Ctrl_C; --- 7053,7059 ---- } else { ! # if defined(FEAT_EVAL) /* autocmds may abort script processing */ if (aborting() && cmdwin_result != K_IGNORE) cmdwin_result = Ctrl_C; *************** *** 7141,7150 **** } } - # ifdef FEAT_AUTOCMD /* Don't execute autocommands while deleting the window. */ block_autocmds(); - # endif # ifdef FEAT_CONCEAL /* Avoid command-line window first character being concealed. */ curwin->w_p_cole = 0; --- 7114,7121 ---- *************** *** 7162,7170 **** /* Restore window sizes. */ win_size_restore(&winsizes); - # ifdef FEAT_AUTOCMD unblock_autocmds(); - # endif } ga_clear(&winsizes); --- 7133,7139 ---- *** ../vim-8.0.1563/src/fileio.c 2018-02-10 18:45:21.056822244 +0100 --- src/fileio.c 2018-03-04 16:04:18.359489388 +0100 *************** *** 47,60 **** static void msg_add_eol(void); static int check_mtime(buf_T *buf, stat_T *s); static int time_differs(long t1, long t2); - #ifdef FEAT_AUTOCMD static int apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, exarg_T *eap); static int au_find_group(char_u *name); # define AUGROUP_DEFAULT -1 /* default autocmd group */ # define AUGROUP_ERROR -2 /* erroneous autocmd group */ # define AUGROUP_ALL -3 /* all autocmd groups */ - #endif #if defined(FEAT_CRYPT) || defined(FEAT_MBYTE) # define HAS_BW_FLAGS --- 47,58 ---- *************** *** 135,145 **** #ifdef TEMPDIRNAMES static void vim_settempdir(char_u *tempdir); #endif - #ifdef FEAT_AUTOCMD static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name"); - #endif - #ifdef FEAT_AUTOCMD /* * Set by the apply_autocmds_group function if the given event is equal to * EVENT_FILETYPE. Used by the readfile function in order to determine if --- 133,140 ---- *************** *** 149,155 **** * apply_autocmds_group. */ static int au_did_filetype INIT(= FALSE); - #endif void filemess( --- 144,149 ---- *************** *** 307,323 **** char_u conv_rest[CONV_RESTLEN]; int conv_restlen = 0; /* nr of bytes in conv_rest[] */ #endif - #ifdef FEAT_AUTOCMD buf_T *old_curbuf; char_u *old_b_ffname; char_u *old_b_fname; int using_b_ffname; int using_b_fname; - #endif - #ifdef FEAT_AUTOCMD au_did_filetype = FALSE; /* reset before triggering any autocommands */ - #endif curbuf->b_no_eol_lnum = 0; /* in case it was set by the previous read */ --- 301,313 ---- *************** *** 337,343 **** return FAIL; } - #ifdef FEAT_AUTOCMD /* Remember the initial values of curbuf, curbuf->b_ffname and * curbuf->b_fname to detect whether they are altered as a result of * executing nasty autocommands. Also check if "fname" and "sfname" --- 327,332 ---- *************** *** 348,354 **** using_b_ffname = (fname == curbuf->b_ffname) || (sfname == curbuf->b_ffname); using_b_fname = (fname == curbuf->b_fname) || (sfname == curbuf->b_fname); - #endif /* After reading a file the cursor line changes but we don't want to * display the line. */ --- 337,342 ---- *************** *** 369,375 **** fname = sfname; #endif - #ifdef FEAT_AUTOCMD /* * The BufReadCmd and FileReadCmd events intercept the reading process by * executing the associated commands instead. --- 357,362 ---- *************** *** 404,410 **** curbuf->b_op_start = pos; } - #endif if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0) msg_scroll = FALSE; /* overwrite previous file message */ --- 391,396 ---- *************** *** 613,619 **** #endif { check_need_swap(newfile); - #ifdef FEAT_AUTOCMD /* SwapExists autocommand may mess things up */ if (curbuf != old_curbuf || (using_b_ffname --- 599,604 ---- *************** *** 624,630 **** EMSG(_(e_auchangedbuf)); return FAIL; } - #endif } if (dir_of_file_exists(fname)) filemess(curbuf, sfname, (char_u *)_("[New File]"), 0); --- 609,614 ---- *************** *** 641,654 **** if (eap != NULL) set_forced_fenc(eap); #endif - #ifdef FEAT_AUTOCMD apply_autocmds_exarg(EVENT_BUFNEWFILE, sfname, sfname, FALSE, curbuf, eap); - #endif /* remember the current fileformat */ save_file_ff(curbuf); ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return FAIL; #endif --- 625,636 ---- if (eap != NULL) set_forced_fenc(eap); #endif apply_autocmds_exarg(EVENT_BUFNEWFILE, sfname, sfname, FALSE, curbuf, eap); /* remember the current fileformat */ save_file_ff(curbuf); ! #if defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return FAIL; #endif *************** *** 701,707 **** #endif { check_need_swap(newfile); - #ifdef FEAT_AUTOCMD if (!read_stdin && (curbuf != old_curbuf || (using_b_ffname && (old_b_ffname != curbuf->b_ffname)) || (using_b_fname && (old_b_fname != curbuf->b_fname)))) --- 683,688 ---- *************** *** 711,717 **** close(fd); return FAIL; } - #endif #ifdef UNIX /* Set swap file protection bits after creating it. */ if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL --- 692,697 ---- *************** *** 764,770 **** try_dos = (vim_strchr(p_ffs, 'd') != NULL); try_unix = (vim_strchr(p_ffs, 'x') != NULL); - #ifdef FEAT_AUTOCMD if (!read_buffer) { int m = msg_scroll; --- 744,749 ---- *************** *** 834,840 **** return FAIL; } } - #endif /* FEAT_AUTOCMD */ /* Autocommands may add lines to the file, need to check if it is empty */ wasempty = (curbuf->b_ml.ml_flags & ML_EMPTY); --- 813,818 ---- *************** *** 2704,2710 **** } #endif - #ifdef FEAT_AUTOCMD if (!read_stdin && !read_fifo && (!read_buffer || sfname != NULL)) { int m = msg_scroll; --- 2682,2687 ---- *************** *** 2746,2752 **** return FAIL; # endif } - #endif if (recoverymode && error) return FAIL; --- 2723,2728 ---- *************** *** 3197,3205 **** #endif /* writing everything */ int whole = (start == 1 && end == buf->b_ml.ml_line_count); - #ifdef FEAT_AUTOCMD linenr_T old_line_count = buf->b_ml.ml_line_count; - #endif int attr; int fileformat; int write_bin; --- 3173,3179 ---- *************** *** 3319,3325 **** buf->b_op_end.lnum = end; buf->b_op_end.col = 0; - #ifdef FEAT_AUTOCMD { aco_save_T aco; int buf_ffname = FALSE; --- 3293,3298 ---- *************** *** 3509,3515 **** if (buf_fname_s) fname = buf->b_sfname; } - #endif #ifdef FEAT_NETBEANS_INTG if (netbeans_active() && isNetbeansBuffer(buf)) --- 3482,3487 ---- *************** *** 5020,5031 **** ) { unchanged(buf, TRUE); - #ifdef FEAT_AUTOCMD /* b:changedtick is always incremented in unchanged() but that * should not trigger a TextChanged event. */ if (buf->b_last_changedtick + 1 == CHANGEDTICK(buf)) buf->b_last_changedtick = CHANGEDTICK(buf); - #endif u_unchanged(buf); u_update_save_nr(buf); } --- 4992,5001 ---- *************** *** 5194,5200 **** } #endif - #ifdef FEAT_AUTOCMD #ifdef FEAT_EVAL if (!should_abort(retval)) #else --- 5164,5169 ---- *************** *** 5232,5238 **** retval = FALSE; #endif } - #endif got_int |= prev_got_int; --- 5201,5206 ---- *************** *** 5246,5282 **** static int set_rw_fname(char_u *fname, char_u *sfname) { - #ifdef FEAT_AUTOCMD buf_T *buf = curbuf; /* It's like the unnamed buffer is deleted.... */ if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; ! # endif if (curbuf != buf) { /* We are in another buffer now, don't do the renaming. */ EMSG(_(e_auchangedbuf)); return FAIL; } - #endif if (setfname(curbuf, fname, sfname, FALSE) == OK) curbuf->b_flags |= BF_NOTEDITED; - #ifdef FEAT_AUTOCMD /* ....and a new named one is created */ apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, curbuf); if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf); ! # ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; ! # endif /* Do filetype detection now if 'filetype' is empty. */ if (*curbuf->b_p_ft == NUL) --- 5214,5247 ---- static int set_rw_fname(char_u *fname, char_u *sfname) { buf_T *buf = curbuf; /* It's like the unnamed buffer is deleted.... */ if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; ! #endif if (curbuf != buf) { /* We are in another buffer now, don't do the renaming. */ EMSG(_(e_auchangedbuf)); return FAIL; } if (setfname(curbuf, fname, sfname, FALSE) == OK) curbuf->b_flags |= BF_NOTEDITED; /* ....and a new named one is created */ apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, curbuf); if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf); ! #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; ! #endif /* Do filetype detection now if 'filetype' is empty. */ if (*curbuf->b_p_ft == NUL) *************** *** 5285,5291 **** (void)do_doautocmd((char_u *)"filetypedetect BufRead", FALSE, NULL); do_modelines(0); } - #endif return OK; } --- 5250,5255 ---- *************** *** 6105,6112 **** } #endif - #if defined(FEAT_VIMINFO) || defined(FEAT_BROWSE) || \ - defined(FEAT_QUICKFIX) || defined(FEAT_AUTOCMD) || defined(PROTO) /* * Try to find a shortname by comparing the fullname with the current * directory. --- 6069,6074 ---- *************** *** 6130,6136 **** vim_free(dirname); return p; } - #endif /* * Try to find a shortname by comparing the fullname with the current --- 6092,6097 ---- *************** *** 6781,6790 **** } if (!stuff_empty() || global_busy || !typebuf_typed() ! #ifdef FEAT_AUTOCMD ! || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0 ! #endif ! ) need_check_timestamps = TRUE; /* check later */ else { --- 6742,6748 ---- } if (!stuff_empty() || global_busy || !typebuf_typed() ! || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0) need_check_timestamps = TRUE; /* check later */ else { *************** *** 6898,6911 **** #ifdef FEAT_GUI int save_mouse_correct = need_mouse_correct; #endif - #ifdef FEAT_AUTOCMD static int busy = FALSE; int n; char_u *s; bufref_T bufref; set_bufref(&bufref, buf); - #endif /* If there is no file name, the buffer is not loaded, 'buftype' is * set, we are in the middle of a save or being called recursively: ignore --- 6856,6869 ---- #ifdef FEAT_GUI int save_mouse_correct = need_mouse_correct; #endif static int busy = FALSE; int n; + #ifdef FEAT_EVAL char_u *s; + #endif bufref_T bufref; set_bufref(&bufref, buf); /* If there is no file name, the buffer is not loaded, 'buftype' is * set, we are in the middle of a save or being called recursively: ignore *************** *** 6914,6922 **** || buf->b_ml.ml_mfp == NULL || *buf->b_p_bt != NUL || buf->b_saving - #ifdef FEAT_AUTOCMD || busy - #endif #ifdef FEAT_NETBEANS_INTG || isNetbeansBuffer(buf) #endif --- 6872,6878 ---- *************** *** 6977,6993 **** else reason = "time"; - #ifdef FEAT_AUTOCMD /* * Only give the warning if there are no FileChangedShell * autocommands. * Avoid being called recursively by setting "busy". */ busy = TRUE; ! # ifdef FEAT_EVAL set_vim_var_string(VV_FCS_REASON, (char_u *)reason, -1); set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", -1); ! # endif ++allbuf_lock; n = apply_autocmds(EVENT_FILECHANGEDSHELL, buf->b_fname, buf->b_fname, FALSE, buf); --- 6933,6948 ---- else reason = "time"; /* * Only give the warning if there are no FileChangedShell * autocommands. * Avoid being called recursively by setting "busy". */ busy = TRUE; ! #ifdef FEAT_EVAL set_vim_var_string(VV_FCS_REASON, (char_u *)reason, -1); set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", -1); ! #endif ++allbuf_lock; n = apply_autocmds(EVENT_FILECHANGEDSHELL, buf->b_fname, buf->b_fname, FALSE, buf); *************** *** 6997,7014 **** { if (!bufref_valid(&bufref)) EMSG(_("E246: FileChangedShell autocommand deleted buffer")); ! # ifdef FEAT_EVAL s = get_vim_var_str(VV_FCS_CHOICE); if (STRCMP(s, "reload") == 0 && *reason != 'd') reload = TRUE; else if (STRCMP(s, "ask") == 0) n = FALSE; else ! # endif return 2; } if (!n) - #endif { if (*reason == 'd') mesg = _("E211: File \"%s\" no longer available"); --- 6952,6968 ---- { if (!bufref_valid(&bufref)) EMSG(_("E246: FileChangedShell autocommand deleted buffer")); ! #ifdef FEAT_EVAL s = get_vim_var_str(VV_FCS_CHOICE); if (STRCMP(s, "reload") == 0 && *reason != 'd') reload = TRUE; else if (STRCMP(s, "ask") == 0) n = FALSE; else ! #endif return 2; } if (!n) { if (*reason == 'd') mesg = _("E211: File \"%s\" no longer available"); *************** *** 7100,7108 **** } else { - # ifdef FEAT_AUTOCMD if (!autocmd_busy) - # endif { msg_start(); msg_puts_attr(tbuf, HL_ATTR(HLF_E) + MSG_HIST); --- 7054,7060 ---- *************** *** 7114,7122 **** if (emsg_silent == 0) { out_flush(); ! # ifdef FEAT_GUI if (!focus) ! # endif /* give the user some time to think about it */ ui_delay(1000L, TRUE); --- 7066,7074 ---- if (emsg_silent == 0) { out_flush(); ! #ifdef FEAT_GUI if (!focus) ! #endif /* give the user some time to think about it */ ui_delay(1000L, TRUE); *************** *** 7151,7162 **** #endif } - #ifdef FEAT_AUTOCMD /* Trigger FileChangedShell when the file was changed in any way. */ if (bufref_valid(&bufref) && retval != 0) (void)apply_autocmds(EVENT_FILECHANGEDSHELLPOST, buf->b_fname, buf->b_fname, FALSE, buf); - #endif #ifdef FEAT_GUI /* restore this in case an autocommand has set it; it would break * 'mousefocus' */ --- 7103,7112 ---- *************** *** 7240,7253 **** if (saved == OK) { curbuf->b_flags |= BF_CHECK_RO; /* check for RO again */ - #ifdef FEAT_AUTOCMD keep_filetype = TRUE; /* don't detect 'filetype' */ - #endif if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, &ea, flags) != OK) { ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (!aborting()) #endif EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname); --- 7190,7201 ---- if (saved == OK) { curbuf->b_flags |= BF_CHECK_RO; /* check for RO again */ keep_filetype = TRUE; /* don't detect 'filetype' */ if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, &ea, flags) != OK) { ! #if defined(FEAT_EVAL) if (!aborting()) #endif EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname); *************** *** 7296,7304 **** curwin->w_cursor = old_cursor; check_cursor(); update_topline(); - #ifdef FEAT_AUTOCMD keep_filetype = FALSE; - #endif #ifdef FEAT_FOLDING { win_T *wp; --- 7244,7250 ---- *************** *** 7672,7683 **** /* * Code for automatic commands. - * - * Only included when "FEAT_AUTOCMD" has been defined. */ - #if defined(FEAT_AUTOCMD) || defined(PROTO) - /* * The autocommands are stored in a list for each event. * Autocommands for the same pattern, that are consecutive, are joined --- 7618,7625 ---- *************** *** 7914,7922 **** static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group); static int apply_autocmds_group(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(AutoPatCmd *apc, int stop_at_last); - #if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) static int match_file_pat(char_u *pattern, regprog_T **prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs); - #endif static event_T last_event; --- 7856,7862 ---- *************** *** 9014,9020 **** * Search for a visible window containing the current buffer. If there isn't * one then use "aucmd_win". * Set "curbuf" and "curwin" to match "buf". - * When FEAT_AUTOCMD is not defined another version is used, see below. */ void aucmd_prepbuf( --- 8954,8959 ---- *************** *** 9067,9073 **** --- 9006,9014 ---- aco->use_aucmd_win = TRUE; aucmd_win_used = TRUE; aucmd_win->w_buffer = buf; + #if defined(FEAT_SYN_HL) || defined(FEAT_SPELL) aucmd_win->w_s = &buf->b_s; + #endif ++buf->b_nwindows; win_init_empty(aucmd_win); /* set cursor and topline to safe values */ *************** *** 9108,9114 **** /* * Cleanup after executing autocommands for a (hidden) buffer. * Restore the window as it was (if possible). - * When FEAT_AUTOCMD is not defined another version is used, see below. */ void aucmd_restbuf( --- 9049,9054 ---- *************** *** 9406,9418 **** static int apply_autocmds_group( event_T event, ! char_u *fname, /* NULL or empty means use actual file name */ ! char_u *fname_io, /* fname to use for on cmdline, NULL means use fname */ ! int force, /* when TRUE, ignore autocmd_busy */ ! int group, /* group ID, or AUGROUP_ALL */ ! buf_T *buf, /* buffer for */ ! exarg_T *eap) /* command arguments */ { char_u *sfname = NULL; /* short file name */ char_u *tail; --- 9346,9358 ---- static int apply_autocmds_group( event_T event, ! char_u *fname, /* NULL or empty means use actual file name */ ! char_u *fname_io, /* fname to use for on cmdline, NULL means use fname */ ! int force, /* when TRUE, ignore autocmd_busy */ ! int group, /* group ID, or AUGROUP_ALL */ ! buf_T *buf, /* buffer for */ ! exarg_T *eap UNUSED) /* command arguments */ { char_u *sfname = NULL; /* short file name */ char_u *tail; *************** *** 10210,10252 **** return retval; } - #else /* FEAT_AUTOCMD */ - - /* - * Prepare for executing commands for (hidden) buffer "buf". - * This is the non-autocommand version, it simply saves "curbuf" and sets - * "curbuf" and "curwin" to match "buf". - */ - void - aucmd_prepbuf( - aco_save_T *aco, /* structure to save values in */ - buf_T *buf) /* new curbuf */ - { - aco->save_curbuf = curbuf; - --curbuf->b_nwindows; - curbuf = buf; - curwin->w_buffer = buf; - ++curbuf->b_nwindows; - } - - /* - * Restore after executing commands for a (hidden) buffer. - * This is the non-autocommand version. - */ - void - aucmd_restbuf( - aco_save_T *aco) /* structure holding saved values */ - { - --curbuf->b_nwindows; - curbuf = aco->save_curbuf; - curwin->w_buffer = curbuf; - ++curbuf->b_nwindows; - } - - #endif /* FEAT_AUTOCMD */ - - #if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) || defined(PROTO) /* * Try matching a filename with a "pattern" ("prog" is NULL), or use the * precompiled regprog "prog" ("pattern" is NULL). That avoids calling --- 10150,10156 ---- *************** *** 10292,10298 **** vim_regfree(regmatch.regprog); return result; } - #endif #if defined(FEAT_WILDIGN) || defined(PROTO) /* --- 10196,10201 ---- *** ../vim-8.0.1563/src/getchar.c 2018-02-27 16:29:24.437343097 +0100 --- src/getchar.c 2018-03-04 17:00:21.093757262 +0100 *************** *** 516,522 **** } } - #if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* * Save redobuff and old_redobuff to save_redobuff and save_old_redobuff. * Used before executing autocommands and user functions. --- 516,521 ---- *************** *** 552,558 **** free_buff(&old_redobuff); old_redobuff = save_redo->sr_old_redobuff; } - #endif /* * Append "s" to the redo buffer. --- 551,556 ---- *************** *** 2891,2897 **** + typebuf.tb_len] != NUL) typebuf.tb_noremap[typebuf.tb_off + typebuf.tb_len++] = RM_YES; ! #ifdef FEAT_MBYTE /* Get IM status right after getting keys, not after the * timeout for a mapping (focus may be lost by then). */ vgetc_im_active = im_get_status(); --- 2889,2895 ---- + typebuf.tb_len] != NUL) typebuf.tb_noremap[typebuf.tb_off + typebuf.tb_len++] = RM_YES; ! #ifdef HAVE_INPUT_METHOD /* Get IM status right after getting keys, not after the * timeout for a mapping (focus may be lost by then). */ vgetc_im_active = im_get_status(); *************** *** 3122,3131 **** else #endif if (p[0] == NUL || (p[0] == K_SPECIAL - #ifdef FEAT_AUTOCMD /* timeout may generate K_CURSORHOLD */ && (i < 2 || p[1] != KS_EXTRA || p[2] != (int)KE_CURSORHOLD) - #endif #if defined(WIN3264) && !defined(FEAT_GUI) /* Win32 console passes modifiers */ && (i < 2 || p[1] != KS_MODIFIER) --- 3120,3127 ---- *** ../vim-8.0.1563/src/globals.h 2018-02-13 15:17:49.074578201 +0100 --- src/globals.h 2018-03-04 17:02:41.512856406 +0100 *************** *** 385,391 **** EXTERN int is_mac_terminal INIT(= FALSE); /* recognized Terminal.app */ #endif - #ifdef FEAT_AUTOCMD EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */ EXTERN int autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */ EXTERN int autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */ --- 385,390 ---- *************** *** 405,411 **** * Free the buffer/window when autocmd_busy is being set to FALSE. */ EXTERN buf_T *au_pending_free_buf INIT(= NULL); EXTERN win_T *au_pending_free_win INIT(= NULL); - #endif #ifdef FEAT_MOUSE /* --- 404,409 ---- *************** *** 572,581 **** EXTERN win_T *curwin; /* currently active window */ - #ifdef FEAT_AUTOCMD EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */ EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */ - #endif /* * The window layout is kept in a tree of frames. topframe points to the top --- 570,577 ---- *************** *** 639,644 **** --- 635,641 ---- EXTERN int really_exiting INIT(= FALSE); /* TRUE when we are sure to exit, e.g., after * a deadly signal */ + EXTERN int v_dying INIT(= 0); /* internal value of v:dying */ EXTERN int stdout_isatty INIT(= TRUE); /* is stdout a terminal? */ #if defined(FEAT_AUTOCHDIR) *************** *** 664,670 **** /* non-zero when changing text and jumping to * another window or buffer is not allowed */ - #ifdef FEAT_AUTOCMD EXTERN int curbuf_lock INIT(= 0); /* non-zero when the current buffer can't be * changed. Used for FileChangedRO. */ --- 661,666 ---- *************** *** 673,679 **** * changed, no buffer can be deleted and * current directory can't be changed. * Used for SwapExists et al. */ - #endif #ifdef FEAT_EVAL # define HAVE_SANDBOX EXTERN int sandbox INIT(= 0); --- 669,674 ---- *************** *** 986,1000 **** EXTERN int emsg_noredir INIT(= 0); /* don't redirect error messages */ EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */ - #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) \ - || defined(FEAT_AUTOCMD) # define HAS_SWAP_EXISTS_ACTION EXTERN int swap_exists_action INIT(= SEA_NONE); /* For dialog when swap file already * exists. */ EXTERN int swap_exists_did_quit INIT(= FALSE); /* Selected "quit" at the dialog. */ - #endif EXTERN char_u *IObuff; /* sprintf's are done in this buffer, size is IOSIZE */ --- 981,992 ---- *************** *** 1022,1028 **** EXTERN int KeyTyped; /* TRUE if user typed current char */ EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */ ! #ifdef FEAT_MBYTE EXTERN int vgetc_im_active; /* Input Method was active for last character obtained from vgetc() */ #endif --- 1014,1020 ---- EXTERN int KeyTyped; /* TRUE if user typed current char */ EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */ ! #ifdef HAVE_INPUT_METHOD EXTERN int vgetc_im_active; /* Input Method was active for last character obtained from vgetc() */ #endif *************** *** 1075,1081 **** #ifdef FEAT_CMDHIST EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */ #endif - #ifdef FEAT_AUTOCMD EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for on cmdline */ EXTERN int autocmd_fname_full; /* autocmd_fname is full path */ EXTERN int autocmd_bufnr INIT(= 0); /* fnum for on cmdline */ --- 1067,1072 ---- *************** *** 1086,1092 **** = INIT_POS_T(0, 0, 0) # endif ; - #endif EXTERN int postponed_split INIT(= 0); /* for CTRL-W CTRL-] command */ EXTERN int postponed_split_flags INIT(= 0); /* args for win_split() */ --- 1077,1082 ---- *************** *** 1595,1603 **** EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name")); #endif EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\"")); - #ifdef FEAT_AUTOCMD EXTERN char_u e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior")); - #endif #ifdef FEAT_GUI_MAC EXTERN short disallow_gui INIT(= FALSE); --- 1585,1591 ---- *** ../vim-8.0.1563/src/gui.c 2018-02-04 19:01:27.422811176 +0100 --- src/gui.c 2018-03-04 16:07:04.174425183 +0100 *************** *** 132,144 **** vim_free(old_term); - #ifdef FEAT_AUTOCMD /* If the GUI started successfully, trigger the GUIEnter event, otherwise * the GUIFailed event. */ gui_mch_update(); apply_autocmds(gui.in_use ? EVENT_GUIENTER : EVENT_GUIFAILED, NULL, NULL, FALSE, curbuf); - #endif --recursive; } --- 132,142 ---- *************** *** 2954,2960 **** gui_wait_for_chars(long wtime, int tb_change_cnt) { int retval; ! #if defined(ELAPSED_FUNC) && defined(FEAT_AUTOCMD) ELAPSED_TYPE start_tv; #endif --- 2952,2958 ---- gui_wait_for_chars(long wtime, int tb_change_cnt) { int retval; ! #if defined(ELAPSED_FUNC) ELAPSED_TYPE start_tv; #endif *************** *** 2986,2992 **** return retval; } ! #if defined(ELAPSED_FUNC) && defined(FEAT_AUTOCMD) ELAPSED_INIT(start_tv); #endif --- 2984,2990 ---- return retval; } ! #if defined(ELAPSED_FUNC) ELAPSED_INIT(start_tv); #endif *************** *** 3003,3013 **** */ if (gui_wait_for_chars_or_timer(p_ut) == OK) retval = OK; - #ifdef FEAT_AUTOCMD else if (trigger_cursorhold() ! # ifdef ELAPSED_FUNC && ELAPSED_FUNC(start_tv) >= p_ut ! # endif && typebuf.tb_change_cnt == tb_change_cnt) { char_u buf[3]; --- 3001,3010 ---- */ if (gui_wait_for_chars_or_timer(p_ut) == OK) retval = OK; else if (trigger_cursorhold() ! #ifdef ELAPSED_FUNC && ELAPSED_FUNC(start_tv) >= p_ut ! #endif && typebuf.tb_change_cnt == tb_change_cnt) { char_u buf[3]; *************** *** 3020,3026 **** retval = OK; } - #endif if (retval == FAIL && typebuf.tb_change_cnt == tb_change_cnt) { --- 3017,3022 ---- *************** *** 5131,5164 **** void gui_update_screen(void) { ! #ifdef FEAT_CONCEAL linenr_T conceal_old_cursor_line = 0; linenr_T conceal_new_cursor_line = 0; int conceal_update_lines = FALSE; ! #endif update_topline(); validate_cursor(); - #if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) /* Trigger CursorMoved if the cursor moved. */ ! if (!finish_op && ( ! # ifdef FEAT_AUTOCMD ! has_cursormoved() ! # endif ! # if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL) ! || ! # endif # ifdef FEAT_CONCEAL ! curwin->w_p_cole > 0 # endif ! ) ! && !EQUAL_POS(last_cursormoved, curwin->w_cursor)) { - # ifdef FEAT_AUTOCMD if (has_cursormoved()) apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf); - # endif # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { --- 5127,5150 ---- void gui_update_screen(void) { ! # ifdef FEAT_CONCEAL linenr_T conceal_old_cursor_line = 0; linenr_T conceal_new_cursor_line = 0; int conceal_update_lines = FALSE; ! # endif update_topline(); validate_cursor(); /* Trigger CursorMoved if the cursor moved. */ ! if (!finish_op && (has_cursormoved() # ifdef FEAT_CONCEAL ! || curwin->w_p_cole > 0 # endif ! ) && !EQUAL_POS(last_cursormoved, curwin->w_cursor)) { if (has_cursormoved()) apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf); # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { *************** *** 5169,5179 **** # endif last_cursormoved = curwin->w_cursor; } - #endif update_screen(0); /* may need to update the screen */ setcursor(); ! # if defined(FEAT_CONCEAL) if (conceal_update_lines && (conceal_old_cursor_line != conceal_new_cursor_line || conceal_cursor_line(curwin) --- 5155,5164 ---- # endif last_cursormoved = curwin->w_cursor; } update_screen(0); /* may need to update the screen */ setcursor(); ! # ifdef FEAT_CONCEAL if (conceal_update_lines && (conceal_old_cursor_line != conceal_new_cursor_line || conceal_cursor_line(curwin) *** ../vim-8.0.1563/src/if_cscope.c 2018-02-10 18:45:21.064822187 +0100 --- src/if_cscope.c 2018-03-04 16:07:23.658300112 +0100 *************** *** 1147,1163 **** return FALSE; } - # ifdef FEAT_AUTOCMD if (*qfpos != '0' && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope", curbuf->b_fname, TRUE, curbuf)) { ! # ifdef FEAT_EVAL if (aborting()) return FALSE; - # endif - } # endif } #endif --- 1147,1161 ---- return FALSE; } if (*qfpos != '0' && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope", curbuf->b_fname, TRUE, curbuf)) { ! # ifdef FEAT_EVAL if (aborting()) return FALSE; # endif + } } #endif *************** *** 1251,1260 **** postponed_split = 0; } - # ifdef FEAT_AUTOCMD apply_autocmds(EVENT_QUICKFIXCMDPOST, (char_u *)"cscope", curbuf->b_fname, TRUE, curbuf); - # endif if (use_ll) /* * In the location list window, use the displayed location --- 1249,1256 ---- *** ../vim-8.0.1563/src/if_xcmdsrv.c 2018-02-27 17:25:48.016151913 +0100 --- src/if_xcmdsrv.c 2018-03-04 16:07:56.218091177 +0100 *************** *** 1480,1493 **** ga_concat(&(r->strings), str); ga_append(&(r->strings), NUL); } - #ifdef FEAT_AUTOCMD { char_u winstr[30]; sprintf((char *)winstr, "0x%x", (unsigned int)win); apply_autocmds(EVENT_REMOTEREPLY, winstr, str, TRUE, curbuf); } - #endif vim_free(tofree); } else --- 1480,1491 ---- *** ../vim-8.0.1563/src/main.c 2018-03-01 23:10:38.611140189 +0100 --- src/main.c 2018-03-04 16:09:53.541339059 +0100 *************** *** 748,757 **** if (exmode_active) curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); TIME_MSG("BufEnter autocommands"); - #endif setpcmark(); #ifdef FEAT_QUICKFIX --- 748,755 ---- *************** *** 843,852 **** #ifdef FEAT_EVAL set_vim_var_nr(VV_VIM_DID_ENTER, 1L); #endif - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf); TIME_MSG("VimEnter autocommands"); - #endif #if defined(FEAT_EVAL) && defined(FEAT_CLIPBOARD) /* Adjust default register name for "unnamed" in 'clipboard'. Can only be --- 841,848 ---- *************** *** 1162,1211 **** skip_redraw = FALSE; else if (do_redraw || stuff_empty()) { ! # ifdef FEAT_GUI /* If ui_breakcheck() was used a resize may have been postponed. */ gui_may_resize_shell(); ! # endif ! #if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) /* Trigger CursorMoved if the cursor moved. */ if (!finish_op && ( - # ifdef FEAT_AUTOCMD has_cursormoved() ! # endif ! # if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL) ! || ! # endif ! # ifdef FEAT_CONCEAL ! curwin->w_p_cole > 0 ! # endif ) ! # ifdef FEAT_AUTOCMD ! && !EQUAL_POS(last_cursormoved, curwin->w_cursor) ! # endif ! ) { - # ifdef FEAT_AUTOCMD if (has_cursormoved()) apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf); - # endif # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { - # ifdef FEAT_AUTOCMD conceal_old_cursor_line = last_cursormoved.lnum; - # endif conceal_new_cursor_line = curwin->w_cursor.lnum; conceal_update_lines = TRUE; } # endif - # ifdef FEAT_AUTOCMD last_cursormoved = curwin->w_cursor; - # endif } - #endif - #ifdef FEAT_AUTOCMD /* Trigger TextChanged if b:changedtick differs. */ if (!finish_op && has_textchanged() && curbuf->b_last_changedtick != CHANGEDTICK(curbuf)) --- 1158,1190 ---- skip_redraw = FALSE; else if (do_redraw || stuff_empty()) { ! #ifdef FEAT_GUI /* If ui_breakcheck() was used a resize may have been postponed. */ gui_may_resize_shell(); ! #endif /* Trigger CursorMoved if the cursor moved. */ if (!finish_op && ( has_cursormoved() ! #ifdef FEAT_CONCEAL ! || curwin->w_p_cole > 0 ! #endif ) ! && !EQUAL_POS(last_cursormoved, curwin->w_cursor)) { if (has_cursormoved()) apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf); # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { conceal_old_cursor_line = last_cursormoved.lnum; conceal_new_cursor_line = curwin->w_cursor.lnum; conceal_update_lines = TRUE; } # endif last_cursormoved = curwin->w_cursor; } /* Trigger TextChanged if b:changedtick differs. */ if (!finish_op && has_textchanged() && curbuf->b_last_changedtick != CHANGEDTICK(curbuf)) *************** *** 1213,1219 **** apply_autocmds(EVENT_TEXTCHANGED, NULL, NULL, FALSE, curbuf); curbuf->b_last_changedtick = CHANGEDTICK(curbuf); } - #endif #if defined(FEAT_DIFF) && defined(FEAT_SCROLLBIND) /* Scroll-binding for diff mode may have been postponed until --- 1192,1197 ---- *************** *** 1292,1298 **** may_clear_sb_text(); /* clear scroll-back text on next msg */ showruler(FALSE); ! # if defined(FEAT_CONCEAL) if (conceal_update_lines && (conceal_old_cursor_line != conceal_new_cursor_line || conceal_cursor_line(curwin) --- 1270,1276 ---- may_clear_sb_text(); /* clear scroll-back text on next msg */ showruler(FALSE); ! #if defined(FEAT_CONCEAL) if (conceal_update_lines && (conceal_old_cursor_line != conceal_new_cursor_line || conceal_cursor_line(curwin) *************** *** 1307,1313 **** mch_enable_flush(); curwin->w_valid &= ~VALID_CROW; } ! # endif setcursor(); cursor_on(); --- 1285,1291 ---- mch_enable_flush(); curwin->w_valid &= ~VALID_CROW; } ! #endif setcursor(); cursor_on(); *************** *** 1405,1415 **** void getout(int exitval) { ! #ifdef FEAT_AUTOCMD buf_T *buf; win_T *wp; - tabpage_T *tp, *next_tp; - #endif exiting = TRUE; --- 1383,1392 ---- void getout(int exitval) { ! tabpage_T *tp; ! tabpage_T *next_tp; buf_T *buf; win_T *wp; exiting = TRUE; *************** *** 1434,1441 **** msg_didany = FALSE; #endif ! #ifdef FEAT_AUTOCMD ! if (get_vim_var_nr(VV_DYING) <= 1) { /* Trigger BufWinLeave for all windows, but only once per buffer. */ for (tp = first_tabpage; tp != NULL; tp = next_tp) --- 1411,1417 ---- msg_didany = FALSE; #endif ! if (v_dying <= 1) { /* Trigger BufWinLeave for all windows, but only once per buffer. */ for (tp = first_tabpage; tp != NULL; tp = next_tp) *************** *** 1479,1485 **** } apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf); } - #endif #ifdef FEAT_VIMINFO if (*p_viminfo != NUL) --- 1455,1460 ---- *************** *** 1487,1496 **** write_viminfo(NULL, FALSE); #endif ! #ifdef FEAT_AUTOCMD ! if (get_vim_var_nr(VV_DYING) <= 1) apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf); - #endif #ifdef FEAT_PROFILE profile_dump(); --- 1462,1469 ---- write_viminfo(NULL, FALSE); #endif ! if (v_dying <= 1) apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf); #ifdef FEAT_PROFILE profile_dump(); *************** *** 1507,1519 **** wait_return(FALSE); } - #ifdef FEAT_AUTOCMD /* Position the cursor again, the autocommands may have moved it */ ! # ifdef FEAT_GUI if (!gui.in_use) - # endif - windgoto((int)Rows - 1, 0); #endif #ifdef FEAT_JOB_CHANNEL job_stop_on_exit(); --- 1480,1490 ---- wait_return(FALSE); } /* Position the cursor again, the autocommands may have moved it */ ! #ifdef FEAT_GUI if (!gui.in_use) #endif + windgoto((int)Rows - 1, 0); #ifdef FEAT_JOB_CHANNEL job_stop_on_exit(); *************** *** 2701,2713 **** * Commands in the .vimrc might have loaded a file or split the window. * Watch out for autocommands that delete a window. */ - #ifdef FEAT_AUTOCMD /* * Don't execute Win/Buf Enter/Leave autocommands here */ ++autocmd_no_enter; ++autocmd_no_leave; - #endif dorewind = TRUE; while (done++ < 1000) { --- 2672,2682 ---- *************** *** 2767,2775 **** else handle_swap_exists(NULL); #endif - #ifdef FEAT_AUTOCMD dorewind = TRUE; /* start again */ - #endif } ui_breakcheck(); if (got_int) --- 2736,2742 ---- *************** *** 2783,2792 **** else curwin = firstwin; curbuf = curwin->w_buffer; - #ifdef FEAT_AUTOCMD --autocmd_no_enter; --autocmd_no_leave; - #endif } } --- 2750,2757 ---- *************** *** 2804,2816 **** int advance = TRUE; win_T *win; - # ifdef FEAT_AUTOCMD /* * Don't execute Win/Buf Enter/Leave autocommands here */ ++autocmd_no_enter; ++autocmd_no_leave; - # endif /* When w_arg_idx is -1 remove the window (see create_windows()). */ if (curwin->w_arg_idx == -1) --- 2769,2779 ---- *************** *** 2891,2899 **** if (parmp->window_layout == WIN_TABS) goto_tabpage(1); - # ifdef FEAT_AUTOCMD --autocmd_no_enter; - # endif /* make the first window the current window */ win = firstwin; --- 2854,2860 ---- *************** *** 2911,2919 **** #endif win_enter(win, FALSE); - #ifdef FEAT_AUTOCMD --autocmd_no_leave; - #endif TIME_MSG("editing files in windows"); if (parmp->window_count > 1 && parmp->window_layout != WIN_TABS) win_equal(curwin, FALSE, 'b'); /* adjust heights */ --- 2872,2878 ---- *** ../vim-8.0.1563/src/mbyte.c 2018-02-27 17:25:48.012151938 +0100 --- src/mbyte.c 2018-03-04 16:50:05.545734812 +0100 *************** *** 799,809 **** fix_arg_enc(); #endif - #ifdef FEAT_AUTOCMD /* Fire an autocommand to let people do custom font setup. This must be * after Vim has been setup for the new encoding. */ apply_autocmds(EVENT_ENCODINGCHANGED, NULL, (char_u *)"", FALSE, curbuf); - #endif #ifdef FEAT_SPELL /* Need to reload spell dictionaries */ --- 799,807 ---- *************** *** 4792,4798 **** # define USE_IMSTATUSFUNC (*p_imsf != NUL) #endif ! #if defined(FEAT_EVAL) && defined(FEAT_MBYTE) static void call_imactivatefunc(int active) { --- 4790,4797 ---- # define USE_IMSTATUSFUNC (*p_imsf != NUL) #endif ! #if defined(FEAT_EVAL) && defined(FEAT_MBYTE) \ ! && (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM)) static void call_imactivatefunc(int active) { *************** *** 4811,4821 **** int is_active; /* FIXME: Don't execute user function in unsafe situation. */ ! if (exiting ! # ifdef FEAT_AUTOCMD ! || is_autocmd_blocked() ! # endif ! ) return FALSE; /* FIXME: :py print 'xxx' is shown duplicate result. * Use silent to avoid it. */ --- 4810,4816 ---- int is_active; /* FIXME: Don't execute user function in unsafe situation. */ ! if (exiting || is_autocmd_blocked()) return FALSE; /* FIXME: :py print 'xxx' is shown duplicate result. * Use silent to avoid it. */ *************** *** 5698,5708 **** void xim_reset(void) { ! #ifdef FEAT_EVAL if (USE_IMACTIVATEFUNC) call_imactivatefunc(im_is_active); else ! #endif if (xic != NULL) { gtk_im_context_reset(xic); --- 5693,5703 ---- void xim_reset(void) { ! # ifdef FEAT_EVAL if (USE_IMACTIVATEFUNC) call_imactivatefunc(im_is_active); else ! # endif if (xic != NULL) { gtk_im_context_reset(xic); *************** *** 6482,6492 **** #else /* !defined(FEAT_XIM) */ ! # if !defined(FEAT_GUI_W32) || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)) static int im_was_set_active = FALSE; int ! im_get_status() { # if defined(FEAT_MBYTE) && defined(FEAT_EVAL) if (USE_IMSTATUSFUNC) --- 6477,6487 ---- #else /* !defined(FEAT_XIM) */ ! # ifdef IME_WITHOUT_XIM static int im_was_set_active = FALSE; int ! im_get_status(void) { # if defined(FEAT_MBYTE) && defined(FEAT_EVAL) if (USE_IMSTATUSFUNC) *** ../vim-8.0.1563/src/memline.c 2018-02-10 18:45:21.068822158 +0100 --- src/memline.c 2018-03-04 16:10:50.912971687 +0100 *************** *** 1732,1744 **** } if (serious_error && called_from_main) ml_close(curbuf, TRUE); - #ifdef FEAT_AUTOCMD else { apply_autocmds(EVENT_BUFREADPOST, NULL, curbuf->b_fname, FALSE, curbuf); apply_autocmds(EVENT_BUFWINENTER, NULL, curbuf->b_fname, FALSE, curbuf); } - #endif return; } --- 1732,1742 ---- *************** *** 4071,4077 **** --no_wait_return; } ! #ifdef FEAT_AUTOCMD static int do_swapexists(buf_T *buf, char_u *fname); /* --- 4069,4075 ---- --no_wait_return; } ! #if defined(FEAT_EVAL) static int do_swapexists(buf_T *buf, char_u *fname); /* *************** *** 4450,4456 **** #if (defined(UNIX) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) process_still_running = FALSE; #endif ! #ifdef FEAT_AUTOCMD /* * If there is an SwapExists autocommand and we can handle * the response, trigger it. It may return 0 to ask the --- 4448,4454 ---- #if (defined(UNIX) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) process_still_running = FALSE; #endif ! #if defined(FEAT_EVAL) /* * If there is an SwapExists autocommand and we can handle * the response, trigger it. It may return 0 to ask the *** ../vim-8.0.1563/src/menu.c 2018-03-03 18:59:11.616531601 +0100 --- src/menu.c 2018-03-04 16:11:03.004894291 +0100 *************** *** 1907,1913 **** return; mode = menu_mode_chars[mode]; - # ifdef FEAT_AUTOCMD { char_u ename[2]; --- 1907,1912 ---- *************** *** 1915,1921 **** ename[1] = NUL; apply_autocmds(EVENT_MENUPOPUP, ename, NULL, FALSE, curbuf); } - # endif for (menu = root_menu; menu != NULL; menu = menu->next) if (STRNCMP("PopUp", menu->name, 5) == 0 && menu->name[5] == mode) --- 1914,1919 ---- *** ../vim-8.0.1563/src/misc1.c 2018-02-22 21:06:44.554819184 +0100 --- src/misc1.c 2018-03-04 16:11:20.572781868 +0100 *************** *** 3183,3194 **** if (must_redraw < VALID) must_redraw = VALID; - #ifdef FEAT_AUTOCMD /* when the cursor line is changed always trigger CursorMoved */ if (lnum <= curwin->w_cursor.lnum && lnume + (xtra < 0 ? -xtra : xtra) > curwin->w_cursor.lnum) last_cursormoved.lnum = 0; - #endif } /* --- 3183,3192 ---- *************** *** 3252,3269 **** if (curbuf->b_did_warn == FALSE && curbufIsChanged() == 0 - #ifdef FEAT_AUTOCMD && !autocmd_busy - #endif && curbuf->b_p_ro) { - #ifdef FEAT_AUTOCMD ++curbuf_lock; apply_autocmds(EVENT_FILECHANGEDRO, NULL, NULL, FALSE, curbuf); --curbuf_lock; if (!curbuf->b_p_ro) return; - #endif /* * Do what msg() does, but with a column offset if the warning should * be after the mode message. --- 3250,3263 ---- *** ../vim-8.0.1563/src/gui_mac.c 2018-02-03 17:36:22.630091837 +0100 --- src/gui_mac.c 2018-03-04 16:52:55.508635540 +0100 *************** *** 6232,6238 **** #endif } ! #if (defined(FEAT_MBYTE) || defined(PROTO)) && defined(USE_CARBONKEYHANDLER) /* * Input Method Control functions. */ --- 6232,6238 ---- #endif } ! #if (defined(FEAT_MBYTE) && defined(USE_CARBONKEYHANDLER)) || defined(PROTO) /* * Input Method Control functions. */ *** ../vim-8.0.1563/src/misc2.c 2018-02-10 18:45:21.072822129 +0100 --- src/misc2.c 2018-03-04 16:11:40.400655012 +0100 *************** *** 1099,1108 **** return; entered_free_all_mem = TRUE; - # ifdef FEAT_AUTOCMD /* Don't want to trigger autocommands from here on. */ block_autocmds(); - # endif /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ p_ea = FALSE; --- 1099,1106 ---- *************** *** 1157,1165 **** # endif /* Obviously named calls. */ - # if defined(FEAT_AUTOCMD) free_all_autocmds(); - # endif clear_termcodes(); free_all_marks(); alist_clear(&global_alist); --- 1155,1161 ---- *************** *** 3403,3413 **** vim_strncpy(dir, fname, MAXPATHL - 1); *gettail_sep(dir) = NUL; res = mch_chdir((char *)dir) == 0 ? OK : FAIL; - #ifdef FEAT_AUTOCMD if (res == OK && trigger_autocmd != NULL) apply_autocmds(EVENT_DIRCHANGED, (char_u *)trigger_autocmd, dir, FALSE, curbuf); - #endif return res; } #endif --- 3399,3407 ---- *** ../vim-8.0.1563/src/move.c 2017-09-22 15:20:27.740148617 +0200 --- src/move.c 2018-03-04 16:11:53.684570041 +0100 *************** *** 538,546 **** /* Approximate the value of w_botline */ wp->w_botline += lnum - wp->w_topline; wp->w_topline = lnum; - #ifdef FEAT_AUTOCMD wp->w_topline_was_set = TRUE; - #endif #ifdef FEAT_DIFF wp->w_topfill = 0; #endif --- 538,544 ---- *** ../vim-8.0.1563/src/netbeans.c 2018-02-10 18:45:21.072822129 +0100 --- src/netbeans.c 2018-03-04 16:12:13.788441473 +0100 *************** *** 1581,1589 **** do_update = 1; buf->initDone = TRUE; nb_set_curbuf(buf->bufp); - #if defined(FEAT_AUTOCMD) apply_autocmds(EVENT_BUFREADPOST, 0, 0, FALSE, buf->bufp); - #endif /* handle any postponed key commands */ handle_key_queue(); --- 1581,1587 ---- *************** *** 2160,2176 **** #endif ) { - #ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf->bufp); - #endif buf_write_all(buf->bufp, FALSE); - #ifdef FEAT_AUTOCMD /* an autocommand may have deleted the buffer */ if (!bufref_valid(&bufref)) buf->bufp = NULL; - #endif } } else --- 2158,2170 ---- *** ../vim-8.0.1563/src/normal.c 2018-03-03 18:59:11.612531627 +0100 --- src/normal.c 2018-03-04 17:01:52.189172497 +0100 *************** *** 169,177 **** #ifdef FEAT_DND static void nv_drop(cmdarg_T *cap); #endif - #ifdef FEAT_AUTOCMD static void nv_cursorhold(cmdarg_T *cap); - #endif static void get_op_vcol(oparg_T *oap, colnr_T col, int initial); static char *e_noident = N_("E349: No identifier under cursor"); --- 169,175 ---- *************** *** 424,432 **** #ifdef FEAT_DND {K_DROP, nv_drop, NV_STS, 0}, #endif - #ifdef FEAT_AUTOCMD {K_CURSORHOLD, nv_cursorhold, NV_KEEPREG, 0}, - #endif {K_PS, nv_edit, 0, 0}, }; --- 422,428 ---- *************** *** 595,601 **** #endif } - #ifdef FEAT_AUTOCMD /* Restore counts from before receiving K_CURSORHOLD. This means after * typing "3", handling K_CURSORHOLD and then typing "2" we get "32", not * "3 * 2". */ --- 591,596 ---- *************** *** 606,612 **** oap->prev_opcount = 0; oap->prev_count0 = 0; } - #endif mapped_len = typebuf_maplen(); --- 601,606 ---- *************** *** 737,743 **** } } - #ifdef FEAT_AUTOCMD if (c == K_CURSORHOLD) { /* Save the count values so that ca.opcount and ca.count0 are exactly --- 731,736 ---- *************** *** 745,753 **** oap->prev_opcount = ca.opcount; oap->prev_count0 = ca.count0; } ! else ! #endif ! if (ca.opcount != 0) { /* * If we're in the middle of an operator (including after entering a --- 738,744 ---- oap->prev_opcount = ca.opcount; oap->prev_count0 = ca.count0; } ! else if (ca.opcount != 0) { /* * If we're in the middle of an operator (including after entering a *************** *** 808,817 **** text_locked_msg(); goto normal_end; } - #ifdef FEAT_AUTOCMD if ((nv_cmds[idx].cmd_flags & NV_NCW) && curbuf_locked()) goto normal_end; - #endif /* * In Visual/Select mode, a few keys are handled in a special way. --- 799,806 ---- *************** *** 892,908 **** int lit = FALSE; /* get extra character literally */ int langmap_active = FALSE; /* using :lmap mappings */ int lang; /* getting a text character */ ! #ifdef FEAT_MBYTE int save_smd; /* saved value of p_smd */ #endif ++no_mapping; ++allow_keys; /* no mapping for nchar, but allow key codes */ - #ifdef FEAT_AUTOCMD /* Don't generate a CursorHold event here, most commands can't handle * it, e.g., nv_replace(), nv_csearch(). */ did_cursorhold = TRUE; - #endif if (ca.cmdchar == 'g') { /* --- 881,895 ---- int lit = FALSE; /* get extra character literally */ int langmap_active = FALSE; /* using :lmap mappings */ int lang; /* getting a text character */ ! #ifdef HAVE_INPUT_METHOD int save_smd; /* saved value of p_smd */ #endif ++no_mapping; ++allow_keys; /* no mapping for nchar, but allow key codes */ /* Don't generate a CursorHold event here, most commands can't handle * it, e.g., nv_replace(), nv_csearch(). */ did_cursorhold = TRUE; if (ca.cmdchar == 'g') { /* *************** *** 957,963 **** State = LANGMAP; langmap_active = TRUE; } ! #ifdef FEAT_MBYTE save_smd = p_smd; p_smd = FALSE; /* Don't let the IM code show the mode here */ if (lang && curbuf->b_p_iminsert == B_IMODE_IM) --- 944,950 ---- State = LANGMAP; langmap_active = TRUE; } ! #ifdef HAVE_INPUT_METHOD save_smd = p_smd; p_smd = FALSE; /* Don't let the IM code show the mode here */ if (lang && curbuf->b_p_iminsert == B_IMODE_IM) *************** *** 973,979 **** ++allow_keys; State = NORMAL_BUSY; } ! #ifdef FEAT_MBYTE if (lang) { if (curbuf->b_p_iminsert != B_IMODE_LMAP) --- 960,966 ---- ++allow_keys; State = NORMAL_BUSY; } ! #ifdef HAVE_INPUT_METHOD if (lang) { if (curbuf->b_p_iminsert != B_IMODE_LMAP) *************** *** 1102,1111 **** if (need_flushbuf) out_flush(); #endif - #ifdef FEAT_AUTOCMD if (ca.cmdchar != K_IGNORE) did_cursorhold = FALSE; - #endif State = NORMAL; --- 1089,1096 ---- *************** *** 1278,1287 **** #ifdef FEAT_CMDL_INFO if (oap->op_type == OP_NOP && oap->regname == 0 ! # ifdef FEAT_AUTOCMD ! && ca.cmdchar != K_CURSORHOLD ! # endif ! ) clear_showcmd(); #endif --- 1263,1269 ---- #ifdef FEAT_CMDL_INFO if (oap->op_type == OP_NOP && oap->regname == 0 ! && ca.cmdchar != K_CURSORHOLD) clear_showcmd(); #endif *************** *** 6264,6276 **** text_locked_msg(); return; } - #ifdef FEAT_AUTOCMD if (curbuf_locked()) { clearop(cap->oap); return; } - #endif ptr = grab_file_name(cap->count1, &lnum); --- 6246,6256 ---- *************** *** 9597,9603 **** } #endif - #ifdef FEAT_AUTOCMD /* * Trigger CursorHold event. * When waiting for a character for 'updatetime' K_CURSORHOLD is put in the --- 9577,9582 ---- *************** *** 9610,9616 **** did_cursorhold = TRUE; cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */ } - #endif /* * Calculate start/end virtual columns for operating in block mode. --- 9589,9594 ---- *** ../vim-8.0.1563/src/ops.c 2018-02-11 15:07:17.047790943 +0100 --- src/ops.c 2018-03-04 16:13:42.215876345 +0100 *************** *** 1651,1657 **** y_regs[1].y_array = NULL; /* set register one to empty */ } ! #ifdef FEAT_AUTOCMD static void yank_do_autocmd(oparg_T *oap, yankreg_T *reg) { --- 1651,1657 ---- y_regs[1].y_array = NULL; /* set register one to empty */ } ! #if defined(FEAT_EVAL) static void yank_do_autocmd(oparg_T *oap, yankreg_T *reg) { *************** *** 1866,1872 **** } } ! #ifdef FEAT_AUTOCMD if (did_yank && has_textyankpost()) yank_do_autocmd(oap, y_current); #endif --- 1866,1872 ---- } } ! #if defined(FEAT_EVAL) if (did_yank && has_textyankpost()) yank_do_autocmd(oap, y_current); #endif *************** *** 3350,3356 **** # endif #endif ! #ifdef FEAT_AUTOCMD if (!deleting && has_textyankpost()) yank_do_autocmd(oap, y_current); #endif --- 3350,3356 ---- # endif #endif ! #if defined(FEAT_EVAL) if (!deleting && has_textyankpost()) yank_do_autocmd(oap, y_current); #endif *************** *** 3493,3503 **** return; } - #ifdef FEAT_AUTOCMD /* Autocommands may be executed when saving lines for undo, which may make * y_array invalid. Start undo now to avoid that. */ u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1); - #endif if (insert_string != NULL) { --- 3493,3501 ---- *** ../vim-8.0.1563/src/option.c 2018-03-01 21:57:26.519801903 +0100 --- src/option.c 2018-03-04 17:00:03.621869568 +0100 *************** *** 114,122 **** #define PV_FF OPT_BUF(BV_FF) #define PV_FLP OPT_BUF(BV_FLP) #define PV_FO OPT_BUF(BV_FO) ! #ifdef FEAT_AUTOCMD ! # define PV_FT OPT_BUF(BV_FT) ! #endif #define PV_IMI OPT_BUF(BV_IMI) #define PV_IMS OPT_BUF(BV_IMS) #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) --- 114,120 ---- #define PV_FF OPT_BUF(BV_FF) #define PV_FLP OPT_BUF(BV_FLP) #define PV_FO OPT_BUF(BV_FO) ! #define PV_FT OPT_BUF(BV_FT) #define PV_IMI OPT_BUF(BV_IMI) #define PV_IMS OPT_BUF(BV_IMS) #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) *************** *** 319,327 **** static char_u *p_ff; static char_u *p_fo; static char_u *p_flp; - #ifdef FEAT_AUTOCMD static char_u *p_ft; - #endif static long p_iminsert; static long p_imsearch; #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) --- 317,323 ---- *************** *** 1125,1135 **** (char_u *)&p_ek, PV_NONE, {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, {"eventignore", "ei", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, - #ifdef FEAT_AUTOCMD (char_u *)&p_ei, PV_NONE, - #else - (char_u *)NULL, PV_NONE, - #endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"expandtab", "et", P_BOOL|P_VI_DEF|P_VIM, (char_u *)&p_et, PV_ET, --- 1121,1127 ---- *************** *** 1174,1186 **** #endif (char_u *)0L} SCRIPTID_INIT}, {"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME, - #ifdef FEAT_AUTOCMD (char_u *)&p_ft, PV_FT, {(char_u *)"", (char_u *)0L} - #else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} - #endif SCRIPTID_INIT}, {"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP, (char_u *)&p_fcs, PV_NONE, --- 1166,1173 ---- *************** *** 3248,3258 **** #endif static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL}; static char *(p_ead_values[]) = {"both", "ver", "hor", NULL}; - #ifdef FEAT_AUTOCMD static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", "acwrite", NULL}; - #else - static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", NULL}; - #endif static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL}; static char *(p_bs_values[]) = {"indent", "eol", "start", NULL}; #ifdef FEAT_FOLDING --- 3235,3241 ---- *************** *** 4339,4345 **** } #endif ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) static void trigger_optionsset_string( int opt_idx, --- 4322,4328 ---- } #endif ! #if defined(FEAT_EVAL) static void trigger_optionsset_string( int opt_idx, *************** *** 4830,4836 **** char_u *oldval = NULL; /* previous value if *varp */ char_u *newval; char_u *origval = NULL; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) char_u *saved_origval = NULL; char_u *saved_newval = NULL; #endif --- 4813,4819 ---- char_u *oldval = NULL; /* previous value if *varp */ char_u *newval; char_u *origval = NULL; ! #if defined(FEAT_EVAL) char_u *saved_origval = NULL; char_u *saved_newval = NULL; #endif *************** *** 5184,5190 **** */ *(char_u **)(varp) = newval; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (!starting # ifdef FEAT_CRYPT && options[opt_idx].indir != PV_KEY --- 5167,5173 ---- */ *(char_u **)(varp) = newval; ! #if defined(FEAT_EVAL) if (!starting # ifdef FEAT_CRYPT && options[opt_idx].indir != PV_KEY *************** *** 5207,5213 **** errmsg = did_set_string_option(opt_idx, (char_u **)varp, new_value_alloced, oldval, errbuf, opt_flags); ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (errmsg == NULL) trigger_optionsset_string(opt_idx, opt_flags, saved_origval, saved_newval); --- 5190,5196 ---- errmsg = did_set_string_option(opt_idx, (char_u **)varp, new_value_alloced, oldval, errbuf, opt_flags); ! #if defined(FEAT_EVAL) if (errmsg == NULL) trigger_optionsset_string(opt_idx, opt_flags, saved_origval, saved_newval); *************** *** 5726,5734 **** check_string_option(&buf->b_p_cino); parse_cino(buf); #endif - #ifdef FEAT_AUTOCMD check_string_option(&buf->b_p_ft); - #endif #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) check_string_option(&buf->b_p_cinw); #endif --- 5709,5715 ---- *************** *** 5982,5988 **** char_u *s; char_u **varp; char_u *oldval; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) char_u *saved_oldval = NULL; char_u *saved_newval = NULL; #endif --- 5963,5969 ---- char_u *s; char_u **varp; char_u *oldval; ! #if defined(FEAT_EVAL) char_u *saved_oldval = NULL; char_u *saved_newval = NULL; #endif *************** *** 6002,6008 **** oldval = *varp; *varp = s; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (!starting # ifdef FEAT_CRYPT && options[opt_idx].indir != PV_KEY --- 5983,5989 ---- oldval = *varp; *varp = s; ! #if defined(FEAT_EVAL) if (!starting # ifdef FEAT_CRYPT && options[opt_idx].indir != PV_KEY *************** *** 6017,6023 **** opt_flags)) == NULL) did_set_option(opt_idx, opt_flags, TRUE); ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* call autocommand after handling side effects */ if (r == NULL) trigger_optionsset_string(opt_idx, opt_flags, --- 5998,6004 ---- opt_flags)) == NULL) did_set_option(opt_idx, opt_flags, TRUE); ! #if defined(FEAT_EVAL) /* call autocommand after handling side effects */ if (r == NULL) trigger_optionsset_string(opt_idx, opt_flags, *************** *** 6029,6035 **** return r; } - #if defined(FEAT_KEYMAP) || defined(FEAT_AUTOCMD) || defined(FEAT_SYN_HL) /* * Return TRUE if "val" is a valid 'filetype' name. * Also used for 'syntax' and 'keymap'. --- 6010,6015 ---- *************** *** 6044,6050 **** return FALSE; return TRUE; } - #endif /* * Handle string options that need some action to perform when changed. --- 6024,6029 ---- *************** *** 6068,6076 **** /* set when changing an option that only requires a redraw in the GUI */ int redraw_gui_only = FALSE; #endif - #ifdef FEAT_AUTOCMD int ft_changed = FALSE; - #endif /* Get the global option to compare with, otherwise we would have to check * two values for all local options. */ --- 6047,6053 ---- *************** *** 6351,6364 **** } #endif - #ifdef FEAT_AUTOCMD /* 'eventignore' */ else if (varp == &p_ei) { if (check_ei() == FAIL) errmsg = e_invarg; } - #endif #ifdef FEAT_MBYTE /* 'encoding', 'fileencoding', 'termencoding' and 'makeencoding' */ --- 6328,6339 ---- *************** *** 7468,7474 **** } #endif - #ifdef FEAT_AUTOCMD else if (gvarp == &p_ft) { if (!valid_filetype(*varp)) --- 7443,7448 ---- *************** *** 7476,7482 **** else ft_changed = STRCMP(oldval, *varp) != 0; } - #endif #ifdef FEAT_SYN_HL else if (gvarp == &p_syn) --- 7450,7455 ---- *************** *** 7593,7610 **** else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) set_string_option_global(opt_idx, varp); - #ifdef FEAT_AUTOCMD /* * Trigger the autocommand only after setting the flags. */ ! # ifdef FEAT_SYN_HL /* When 'syntax' is set, load the syntax of that name */ if (varp == &(curbuf->b_p_syn)) { apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, curbuf->b_fname, TRUE, curbuf); } ! # endif else if (varp == &(curbuf->b_p_ft)) { /* 'filetype' is set, trigger the FileType autocommand. --- 7566,7582 ---- else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) set_string_option_global(opt_idx, varp); /* * Trigger the autocommand only after setting the flags. */ ! #ifdef FEAT_SYN_HL /* When 'syntax' is set, load the syntax of that name */ if (varp == &(curbuf->b_p_syn)) { apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, curbuf->b_fname, TRUE, curbuf); } ! #endif else if (varp == &(curbuf->b_p_ft)) { /* 'filetype' is set, trigger the FileType autocommand. *************** *** 7620,7626 **** varp = NULL; } } - #endif #ifdef FEAT_SPELL if (varp == &(curwin->w_s->b_p_spl)) { --- 7592,7597 ---- *************** *** 8280,8293 **** #endif } - #ifdef FEAT_AUTOCMD /* when 'buflisted' changes, trigger autocommands */ else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl) { apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE, NULL, NULL, TRUE, curbuf); } - #endif /* when 'swf' is set, create swapfile, when reset remove swapfile */ else if ((int *)varp == &curbuf->b_p_swf) --- 8251,8262 ---- *************** *** 8433,8441 **** #ifdef FEAT_TITLE redraw_titles(); #endif - #ifdef FEAT_AUTOCMD modified_was_set = value; - #endif } #ifdef BACKSLASH_IN_FILENAME --- 8402,8408 ---- *************** *** 8529,8535 **** } #endif ! #ifdef FEAT_MBYTE /* 'imdisable' */ else if ((int *)varp == &p_imdisable) { --- 8496,8502 ---- } #endif ! #ifdef HAVE_INPUT_METHOD /* 'imdisable' */ else if ((int *)varp == &p_imdisable) { *************** *** 8739,8745 **** options[opt_idx].flags |= P_WAS_SET; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (!starting) { char_u buf_old[2], buf_new[2], buf_type[7]; --- 8706,8712 ---- options[opt_idx].flags |= P_WAS_SET; ! #if defined(FEAT_EVAL) if (!starting) { char_u buf_old[2], buf_new[2], buf_type[7]; *************** *** 9289,9295 **** options[opt_idx].flags |= P_WAS_SET; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) if (!starting && errmsg == NULL) { char_u buf_old[11], buf_new[11], buf_type[7]; --- 9256,9262 ---- options[opt_idx].flags |= P_WAS_SET; ! #if defined(FEAT_EVAL) if (!starting && errmsg == NULL) { char_u buf_old[11], buf_new[11], buf_type[7]; *************** *** 10139,10160 **** } else /* P_STRING */ { - #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD) int do_endif = FALSE; /* Don't set 'syntax' and 'filetype' again if the value is * already right, avoids reloading the syntax file. */ if ( ! # if defined(FEAT_SYN_HL) ! p->indir == PV_SYN ! # if defined(FEAT_AUTOCMD) ! || ! # endif ! # endif ! # if defined(FEAT_AUTOCMD) ! p->indir == PV_FT ! # endif ! ) { if (fprintf(fd, "if &%s != '%s'", p->fullname, *(char_u **)(varp)) < 0 --- 10106,10120 ---- } else /* P_STRING */ { int do_endif = FALSE; /* Don't set 'syntax' and 'filetype' again if the value is * already right, avoids reloading the syntax file. */ if ( ! #if defined(FEAT_SYN_HL) ! p->indir == PV_SYN || ! #endif ! p->indir == PV_FT) { if (fprintf(fd, "if &%s != '%s'", p->fullname, *(char_u **)(varp)) < 0 *************** *** 10162,10178 **** return FAIL; do_endif = TRUE; } - #endif if (put_setstring(fd, cmd, p->fullname, (char_u **)varp, (p->flags & P_EXPAND) != 0) == FAIL) return FAIL; - #if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD) if (do_endif) { if (put_line(fd, "endif") == FAIL) return FAIL; } - #endif } } } --- 10122,10135 ---- *************** *** 10783,10791 **** case PV_FENC: return (char_u *)&(curbuf->b_p_fenc); #endif case PV_FF: return (char_u *)&(curbuf->b_p_ff); - #ifdef FEAT_AUTOCMD case PV_FT: return (char_u *)&(curbuf->b_p_ft); - #endif case PV_FO: return (char_u *)&(curbuf->b_p_fo); case PV_FLP: return (char_u *)&(curbuf->b_p_flp); case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert); --- 10740,10746 ---- *************** *** 11200,11209 **** buf->b_p_cink = vim_strsave(p_cink); buf->b_p_cino = vim_strsave(p_cino); #endif - #ifdef FEAT_AUTOCMD /* Don't copy 'filetype', it must be detected */ buf->b_p_ft = empty_option; - #endif buf->b_p_pi = p_pi; #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) buf->b_p_cinw = vim_strsave(p_cinw); --- 11155,11162 ---- *** ../vim-8.0.1563/src/option.h 2018-02-10 15:36:51.138901636 +0100 --- src/option.h 2018-03-04 16:29:40.617769527 +0100 *************** *** 477,485 **** EXTERN char_u *p_gefm; /* 'grepformat' */ EXTERN char_u *p_gp; /* 'grepprg' */ #endif - #ifdef FEAT_AUTOCMD EXTERN char_u *p_ei; /* 'eventignore' */ - #endif EXTERN int p_ek; /* 'esckeys' */ EXTERN int p_exrc; /* 'exrc' */ #ifdef FEAT_MBYTE --- 477,483 ---- *************** *** 1046,1054 **** , BV_FF , BV_FLP , BV_FO - #ifdef FEAT_AUTOCMD , BV_FT - #endif , BV_IMI , BV_IMS #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) --- 1044,1050 ---- *** ../vim-8.0.1563/src/feature.h 2018-03-03 18:59:11.616531601 +0100 --- src/feature.h 2018-03-04 16:30:55.701292128 +0100 *************** *** 440,456 **** #endif /* - * +autocmd ":autocmd" command - */ - #ifdef FEAT_NORMAL - # define FEAT_AUTOCMD - #endif - - /* * +diff Displaying diffs in a nice way. * Requires +windows and +autocmd. */ ! #if defined(FEAT_NORMAL) && defined(FEAT_AUTOCMD) # define FEAT_DIFF #endif --- 440,449 ---- #endif /* * +diff Displaying diffs in a nice way. * Requires +windows and +autocmd. */ ! #if defined(FEAT_NORMAL) # define FEAT_DIFF #endif *** ../vim-8.0.1563/src/vim.h 2018-02-10 18:15:00.758098776 +0100 --- src/vim.h 2018-03-04 16:54:53.283872959 +0100 *************** *** 2118,2123 **** --- 2118,2137 ---- # define USE_MCH_ERRMSG #endif + /* Whether IME is supported when XIM is not used. */ + # if defined(FEAT_MBYTE_IME) && \ + (!defined(FEAT_GUI_W32) || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) + # define IME_WITHOUT_XIM + #endif + + #if defined(FEAT_MBYTE) && (defined(FEAT_XIM) \ + || defined(IME_WITHOUT_XIM) \ + || defined(FEAT_GUI_W32) \ + || defined(MACOS_CONVERT)) + /* im_set_active() is available */ + # define HAVE_INPUT_METHOD + #endif + #ifndef FEAT_MBYTE # define after_pathsep(b, p) vim_ispathsep(*((p) - 1)) # define transchar_byte(c) transchar(c) *** ../vim-8.0.1563/src/os_amiga.c 2018-02-10 18:45:21.076822101 +0100 --- src/os_amiga.c 2018-03-04 16:16:34.898774499 +0100 *************** *** 152,158 **** */ if (WaitForChar(raw_in, p_ut * 1000L) == 0) { - #ifdef FEAT_AUTOCMD if (trigger_cursorhold() && maxlen >= 3) { buf[0] = K_SPECIAL; --- 152,157 ---- *************** *** 160,166 **** buf[2] = (int)KE_CURSORHOLD; return 3; } - #endif before_blocking(); } } --- 159,164 ---- *** ../vim-8.0.1563/src/os_mswin.c 2018-02-10 18:45:21.076822101 +0100 --- src/os_mswin.c 2018-03-04 16:16:49.670680348 +0100 *************** *** 2163,2169 **** (data->dwData == COPYDATA_RESULT ? 1 : 2))) == FAIL) vim_free(str); - #ifdef FEAT_AUTOCMD else if (data->dwData == COPYDATA_REPLY) { char_u winstr[30]; --- 2163,2168 ---- *************** *** 2172,2178 **** apply_autocmds(EVENT_REMOTEREPLY, winstr, str, TRUE, curbuf); } - #endif } return 1; } --- 2171,2176 ---- *** ../vim-8.0.1563/src/os_unix.c 2018-02-27 19:09:56.711821176 +0100 --- src/os_unix.c 2018-03-04 16:17:25.354452979 +0100 *************** *** 445,451 **** { /* no character available within 'updatetime' */ did_start_blocking = TRUE; - #ifdef FEAT_AUTOCMD if (trigger_cursorhold() && maxlen >= 3 && !typebuf_changed(tb_change_cnt)) { --- 445,450 ---- *************** *** 454,460 **** buf[2] = (int)KE_CURSORHOLD; return 3; } - #endif /* * If there is no character available within 'updatetime' * seconds flush all the swap files to disk. --- 453,458 ---- *************** *** 1133,1148 **** /* Remember how often we have been called. */ ++entered; - #ifdef FEAT_AUTOCMD /* Executing autocommands is likely to use more stack space than we have * available in the signal stack. */ block_autocmds(); - #endif #ifdef FEAT_EVAL /* Set the v:dying variable. */ set_vim_var_nr(VV_DYING, (long)entered); #endif #ifdef HAVE_STACK_LIMIT /* Since we are now using the signal stack, need to reset the stack --- 1131,1145 ---- /* Remember how often we have been called. */ ++entered; /* Executing autocommands is likely to use more stack space than we have * available in the signal stack. */ block_autocmds(); #ifdef FEAT_EVAL /* Set the v:dying variable. */ set_vim_var_nr(VV_DYING, (long)entered); #endif + v_dying = entered; #ifdef HAVE_STACK_LIMIT /* Since we are now using the signal stack, need to reset the stack *** ../vim-8.0.1563/src/os_win32.c 2018-02-22 21:06:44.558819084 +0100 --- src/os_win32.c 2018-03-04 16:17:32.034410427 +0100 *************** *** 1787,1793 **** */ if (!WaitForChar(p_ut, FALSE)) { - #ifdef FEAT_AUTOCMD if (trigger_cursorhold() && maxlen >= 3) { buf[0] = K_SPECIAL; --- 1787,1792 ---- *************** *** 1795,1801 **** buf[2] = (int)KE_CURSORHOLD; return 3; } - #endif before_blocking(); } } --- 1794,1799 ---- *** ../vim-8.0.1563/src/quickfix.c 2018-02-11 15:02:44.045572745 +0100 --- src/quickfix.c 2018-03-04 16:20:30.705273464 +0100 *************** *** 3626,3638 **** /* Set the 'filetype' to "qf" each time after filling the buffer. * This resembles reading a file into a buffer, it's more logical when * using autocommands. */ - #ifdef FEAT_AUTOCMD ++curbuf_lock; - #endif set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL); curbuf->b_p_ma = FALSE; - #ifdef FEAT_AUTOCMD keep_filetype = TRUE; /* don't detect 'filetype' */ apply_autocmds(EVENT_BUFREADPOST, (char_u *)"quickfix", NULL, FALSE, curbuf); --- 3626,3635 ---- *************** *** 3640,3646 **** FALSE, curbuf); keep_filetype = FALSE; --curbuf_lock; ! #endif /* make sure it will be redrawn */ redraw_curbuf_later(NOT_VALID); } --- 3637,3643 ---- FALSE, curbuf); keep_filetype = FALSE; --curbuf_lock; ! /* make sure it will be redrawn */ redraw_curbuf_later(NOT_VALID); } *************** *** 3682,3688 **** win_T *wp = NULL; qf_info_T *qi = &ql_info; int res; - #ifdef FEAT_AUTOCMD char_u *au_name = NULL; /* Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal". */ --- 3679,3684 ---- *************** *** 3705,3716 **** if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { ! # ifdef FEAT_EVAL if (aborting()) return; - # endif - } #endif #ifdef FEAT_MBYTE enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; #endif --- 3701,3711 ---- if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { ! #ifdef FEAT_EVAL if (aborting()) return; #endif + } #ifdef FEAT_MBYTE enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; #endif *************** *** 3766,3772 **** qi = GET_LOC_LIST(wp); if (res >= 0 && qi != NULL) qf_list_changed(qi, qi->qf_curlist); - #ifdef FEAT_AUTOCMD if (au_name != NULL) { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, --- 3761,3766 ---- *************** *** 3776,3782 **** else res = 0; } - #endif if (res > 0 && !eap->forceit) qf_jump(qi, 0, 0, FALSE); /* display first error */ --- 3770,3775 ---- *************** *** 4105,4117 **** char_u *enc = NULL; win_T *wp = NULL; qf_info_T *qi = &ql_info; - #ifdef FEAT_AUTOCMD char_u *au_name = NULL; int save_qfid; - #endif int res; - #ifdef FEAT_AUTOCMD switch (eap->cmdidx) { case CMD_cfile: au_name = (char_u *)"cfile"; break; --- 4098,4107 ---- *************** *** 4124,4130 **** } if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf); - #endif #ifdef FEAT_MBYTE enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; #endif --- 4114,4119 ---- *************** *** 4164,4170 **** qi = GET_LOC_LIST(wp); if (res >= 0 && qi != NULL) qf_list_changed(qi, qi->qf_curlist); - #ifdef FEAT_AUTOCMD if (qi != NULL) save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; if (au_name != NULL) --- 4153,4158 ---- *************** *** 4174,4180 **** * is still valid. */ if (qi != NULL && !qflist_valid(wp, save_qfid)) return; - #endif if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)) qf_jump(qi, 0, 0, eap->forceit); /* display first error */ } --- 4162,4167 ---- *************** *** 4198,4208 **** int fi; qf_info_T *qi = &ql_info; int loclist_cmd = FALSE; - #ifdef FEAT_AUTOCMD int_u save_qfid; qfline_T *cur_qf_start; win_T *wp; - #endif long lnum; buf_T *buf; int duplicate_name = FALSE; --- 4185,4193 ---- *************** *** 4212,4218 **** buf_T *first_match_buf = NULL; time_t seconds = 0; int save_mls; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) char_u *save_ei = NULL; #endif aco_save_T aco; --- 4197,4203 ---- buf_T *first_match_buf = NULL; time_t seconds = 0; int save_mls; ! #if defined(FEAT_SYN_HL) char_u *save_ei = NULL; #endif aco_save_T aco; *************** *** 4222,4228 **** char_u *dirname_start = NULL; char_u *dirname_now = NULL; char_u *target_dir = NULL; - #ifdef FEAT_AUTOCMD char_u *au_name = NULL; switch (eap->cmdidx) --- 4207,4212 ---- *************** *** 4240,4251 **** if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { ! # ifdef FEAT_EVAL if (aborting()) return; - # endif - } #endif if (eap->cmdidx == CMD_lgrep || eap->cmdidx == CMD_lvimgrep --- 4224,4234 ---- if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { ! #ifdef FEAT_EVAL if (aborting()) return; #endif + } if (eap->cmdidx == CMD_lgrep || eap->cmdidx == CMD_lvimgrep *************** *** 4325,4336 **** * ":lcd %:p:h" changes the meaning of short path names. */ mch_dirname(dirname_start, MAXPATHL); - #ifdef FEAT_AUTOCMD /* Remember the current values of the quickfix list and qf_start, so that * we can check for autocommands changing the current quickfix list. */ save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start; - #endif seconds = (time_t)0; for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi) --- 4308,4317 ---- *************** *** 4365,4371 **** using_dummy = TRUE; redraw_for_dummy = TRUE; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) /* Don't do Filetype autocommands to avoid loading syntax and * indent scripts, a great speed improvement. */ save_ei = au_event_disable(",Filetype"); --- 4346,4352 ---- using_dummy = TRUE; redraw_for_dummy = TRUE; ! #if defined(FEAT_SYN_HL) /* Don't do Filetype autocommands to avoid loading syntax and * indent scripts, a great speed improvement. */ save_ei = au_event_disable(",Filetype"); *************** *** 4379,4385 **** buf = load_dummy_buffer(fname, dirname_start, dirname_now); p_mls = save_mls; ! #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) au_event_restore(save_ei); #endif } --- 4360,4366 ---- buf = load_dummy_buffer(fname, dirname_start, dirname_now); p_mls = save_mls; ! #if defined(FEAT_SYN_HL) au_event_restore(save_ei); #endif } *************** *** 4387,4393 **** /* Use existing, loaded buffer. */ using_dummy = FALSE; - #ifdef FEAT_AUTOCMD if (loclist_cmd) { /* --- 4368,4373 ---- *************** *** 4419,4425 **** cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start; } } - #endif if (buf == NULL) { --- 4399,4404 ---- *************** *** 4475,4483 **** if (got_int) break; } - #ifdef FEAT_AUTOCMD cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start; - #endif if (using_dummy) { --- 4454,4460 ---- *************** *** 4532,4538 **** * need to be done (again). But not the window-local * options! */ aucmd_prepbuf(&aco, buf); ! #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, buf->b_fname, TRUE, buf); #endif --- 4509,4515 ---- * need to be done (again). But not the window-local * options! */ aucmd_prepbuf(&aco, buf); ! #if defined(FEAT_SYN_HL) apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, buf->b_fname, TRUE, buf); #endif *************** *** 4552,4558 **** qf_update_buffer(qi, NULL); - #ifdef FEAT_AUTOCMD if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); --- 4529,4534 ---- *************** *** 4563,4569 **** wp = loclist_cmd ? curwin : NULL; if (!qflist_valid(wp, save_qfid)) goto theend; - #endif /* Jump to first match. */ if (qi->qf_lists[qi->qf_curlist].qf_count > 0) --- 4539,4544 ---- *************** *** 4748,4754 **** { if (curbuf != buf) /* safety check */ { ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that aborting() --- 4723,4729 ---- { if (curbuf != buf) /* safety check */ { ! #if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that aborting() *************** *** 4759,4765 **** wipe_buffer(buf, FALSE); ! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); --- 4734,4740 ---- wipe_buffer(buf, FALSE); ! #if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); *************** *** 5598,5609 **** { buf_T *buf = NULL; qf_info_T *qi = &ql_info; - #ifdef FEAT_AUTOCMD char_u *au_name = NULL; - #endif int res; - #ifdef FEAT_AUTOCMD switch (eap->cmdidx) { case CMD_cbuffer: au_name = (char_u *)"cbuffer"; break; --- 5573,5581 ---- *************** *** 5617,5628 **** if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { ! # ifdef FEAT_EVAL if (aborting()) return; - # endif - } #endif /* Must come after autocommands. */ if (eap->cmdidx == CMD_lbuffer --- 5589,5599 ---- if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { ! #ifdef FEAT_EVAL if (aborting()) return; #endif + } /* Must come after autocommands. */ if (eap->cmdidx == CMD_lbuffer *************** *** 5670,5680 **** qf_title, NULL); if (res >= 0) qf_list_changed(qi, qi->qf_curlist); - #ifdef FEAT_AUTOCMD if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); - #endif if (res > 0 && (eap->cmdidx == CMD_cbuffer || eap->cmdidx == CMD_lbuffer)) qf_jump(qi, 0, 0, eap->forceit); /* display first error */ --- 5641,5649 ---- *************** *** 5692,5703 **** { typval_T *tv; qf_info_T *qi = &ql_info; - #ifdef FEAT_AUTOCMD char_u *au_name = NULL; - #endif int res; - #ifdef FEAT_AUTOCMD switch (eap->cmdidx) { case CMD_cexpr: au_name = (char_u *)"cexpr"; break; --- 5661,5669 ---- *************** *** 5711,5722 **** if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { ! # ifdef FEAT_EVAL if (aborting()) return; - # endif - } #endif if (eap->cmdidx == CMD_lexpr || eap->cmdidx == CMD_lgetexpr --- 5677,5687 ---- if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { ! #ifdef FEAT_EVAL if (aborting()) return; #endif + } if (eap->cmdidx == CMD_lexpr || eap->cmdidx == CMD_lgetexpr *************** *** 5742,5752 **** NULL); if (res >= 0) qf_list_changed(qi, qi->qf_curlist); - #ifdef FEAT_AUTOCMD if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); - #endif if (res > 0 && (eap->cmdidx == CMD_cexpr || eap->cmdidx == CMD_lexpr)) qf_jump(qi, 0, 0, eap->forceit); /* display first error */ --- 5707,5715 ---- *************** *** 5779,5794 **** qf_info_T *save_qi; int new_qi = FALSE; win_T *wp; - #ifdef FEAT_AUTOCMD char_u *au_name = NULL; - #endif #ifdef FEAT_MULTI_LANG /* Check for a specified language */ lang = check_help_lang(eap->arg); #endif - #ifdef FEAT_AUTOCMD switch (eap->cmdidx) { case CMD_helpgrep: au_name = (char_u *)"helpgrep"; break; --- 5742,5754 ---- *************** *** 5798,5809 **** if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { ! # ifdef FEAT_EVAL if (aborting()) return; - # endif - } #endif /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ save_cpo = p_cpo; --- 5758,5768 ---- if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { ! #ifdef FEAT_EVAL if (aborting()) return; #endif + } /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ save_cpo = p_cpo; *************** *** 5965,5971 **** qf_list_changed(qi, qi->qf_curlist); qf_update_buffer(qi, NULL); - #ifdef FEAT_AUTOCMD if (au_name != NULL) { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, --- 5924,5929 ---- *************** *** 5974,5980 **** /* autocommands made "qi" invalid */ return; } - #endif /* Jump to first match. */ if (qi->qf_lists[qi->qf_curlist].qf_count > 0) --- 5932,5937 ---- *** ../vim-8.0.1563/src/screen.c 2018-02-27 14:38:58.653004777 +0100 --- src/screen.c 2018-03-04 16:21:11.645013268 +0100 *************** *** 8767,8777 **** tabpage_T *tp; static int entered = FALSE; /* avoid recursiveness */ static int done_outofmem_msg = FALSE; /* did outofmem message */ - #ifdef FEAT_AUTOCMD int retry_count = 0; retry: - #endif /* * Allocation of the screen buffers is done only when the size changes and * when Rows and Columns have been set and we have started doing full --- 8767,8775 ---- *************** *** 8823,8832 **** */ FOR_ALL_TAB_WINDOWS(tp, wp) win_free_lsize(wp); - #ifdef FEAT_AUTOCMD if (aucmd_win != NULL) win_free_lsize(aucmd_win); - #endif new_ScreenLines = (schar_T *)lalloc((long_u)( (Rows + 1) * Columns * sizeof(schar_T)), FALSE); --- 8821,8828 ---- *************** *** 8859,8869 **** goto give_up; } } - #ifdef FEAT_AUTOCMD if (aucmd_win != NULL && aucmd_win->w_lines == NULL && win_alloc_lines(aucmd_win) == FAIL) outofmem = TRUE; - #endif give_up: #ifdef FEAT_MBYTE --- 8855,8863 ---- *************** *** 9032,9038 **** entered = FALSE; --RedrawingDisabled; - #ifdef FEAT_AUTOCMD /* * Do not apply autocommands more than 3 times to avoid an endless loop * in case applying autocommands always changes Rows or Columns. --- 9026,9031 ---- *************** *** 9044,9050 **** * jump back to check if we need to allocate the screen again. */ goto retry; } - #endif } void --- 9037,9042 ---- *** ../vim-8.0.1563/src/search.c 2018-02-10 18:45:21.092821986 +0100 --- src/search.c 2018-03-04 16:21:34.064870826 +0100 *************** *** 97,106 **** static int lastc_bytelen = 1; /* >1 for multi-byte char */ #endif - #if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* copy of spats[], for keeping the search patterns while executing autocmds */ static struct spat saved_spats[2]; - #endif # ifdef FEAT_SEARCH_EXTRA /* copy of spats[RE_SEARCH], for keeping the search patterns while incremental * searching */ --- 97,104 ---- *************** *** 300,306 **** } } - #if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* * Save the search patterns, so they can be restored later. * Used before/after executing autocommands and user functions. --- 298,303 ---- *************** *** 318,327 **** saved_spats[1] = spats[1]; if (spats[1].pat != NULL) saved_spats[1].pat = vim_strsave(spats[1].pat); saved_last_idx = last_idx; - # ifdef FEAT_SEARCH_EXTRA saved_no_hlsearch = no_hlsearch; ! # endif } } --- 315,324 ---- saved_spats[1] = spats[1]; if (spats[1].pat != NULL) saved_spats[1].pat = vim_strsave(spats[1].pat); + #ifdef FEAT_SEARCH_EXTRA saved_last_idx = last_idx; saved_no_hlsearch = no_hlsearch; ! #endif } } *************** *** 332,349 **** { vim_free(spats[0].pat); spats[0] = saved_spats[0]; ! # if defined(FEAT_EVAL) set_vv_searchforward(); ! # endif vim_free(spats[1].pat); spats[1] = saved_spats[1]; last_idx = saved_last_idx; - # ifdef FEAT_SEARCH_EXTRA SET_NO_HLSEARCH(saved_no_hlsearch); ! # endif } } - #endif #if defined(EXITFREE) || defined(PROTO) void --- 329,345 ---- { vim_free(spats[0].pat); spats[0] = saved_spats[0]; ! #if defined(FEAT_EVAL) set_vv_searchforward(); ! #endif vim_free(spats[1].pat); spats[1] = saved_spats[1]; + #ifdef FEAT_SEARCH_EXTRA last_idx = saved_last_idx; SET_NO_HLSEARCH(saved_no_hlsearch); ! #endif } } #if defined(EXITFREE) || defined(PROTO) void *** ../vim-8.0.1563/src/spell.c 2018-02-20 21:44:39.390348818 +0100 --- src/spell.c 2018-03-04 16:22:07.236660138 +0100 *************** *** 1849,1857 **** char_u fname_enc[85]; int r; spelload_T sl; - #ifdef FEAT_AUTOCMD int round; - #endif /* Copy the language name to pass it to spell_load_cb() as a cookie. * It's truncated when an error is detected. */ --- 1849,1855 ---- *************** *** 1859,1869 **** sl.sl_slang = NULL; sl.sl_nobreak = FALSE; - #ifdef FEAT_AUTOCMD /* We may retry when no spell file is found for the language, an * autocommand may load it then. */ for (round = 1; round <= 2; ++round) - #endif { /* * Find the first spell file for "lang" in 'runtimepath' and load it. --- 1857,1865 ---- *************** *** 1889,1905 **** lang); r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl); - #ifdef FEAT_AUTOCMD if (r == FAIL && *sl.sl_lang != NUL && round == 1 && apply_autocmds(EVENT_SPELLFILEMISSING, lang, curbuf->b_fname, FALSE, curbuf)) continue; break; - #endif } - #ifdef FEAT_AUTOCMD break; - #endif } if (r == FAIL) --- 1885,1897 ---- *************** *** 2348,2358 **** static int recursive = FALSE; char_u *ret_msg = NULL; char_u *spl_copy; - #ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, wp->w_buffer); - #endif /* We don't want to do this recursively. May happen when a language is * not available and the SpellFileMissing autocommand opens a new buffer --- 2340,2348 ---- *************** *** 2449,2455 **** else { spell_load_lang(lang); - #ifdef FEAT_AUTOCMD /* SpellFileMissing autocommands may do anything, including * destroying the buffer we are using... */ if (!bufref_valid(&bufref)) --- 2439,2444 ---- *************** *** 2457,2463 **** ret_msg = (char_u *)N_("E797: SpellFileMissing autocommand deleted buffer"); goto theend; } - #endif } } --- 2446,2451 ---- *** ../vim-8.0.1563/src/structs.h 2018-03-01 21:57:26.523801873 +0100 --- src/structs.h 2018-03-04 16:30:41.301383655 +0100 *************** *** 586,594 **** int lockmarks; /* TRUE when ":lockmarks" was used */ int keeppatterns; /* TRUE when ":keeppatterns" was used */ int noswapfile; /* TRUE when ":noswapfile" was used */ - # ifdef FEAT_AUTOCMD char_u *save_ei; /* saved value of 'eventignore' */ - # endif regmatch_T filter_regmatch; /* set by :filter /pat/ */ int filter_force; /* set for :filter! */ } cmdmod_T; --- 586,592 ---- *************** *** 1946,1955 **** int b_nwindows; /* nr of windows open on this buffer */ int b_flags; /* various BF_ flags */ - #ifdef FEAT_AUTOCMD int b_locked; /* Buffer is being closed or referenced, don't let autocommands wipe it out. */ - #endif /* * b_ffname has the full path of the file (NULL for no name). --- 1944,1951 ---- *************** *** 1986,1998 **** incremented for each change, also for undo */ #define CHANGEDTICK(buf) ((buf)->b_ct_di.di_tv.vval.v_number) - #ifdef FEAT_AUTOCMD varnumber_T b_last_changedtick; /* b:changedtick when TextChanged or TextChangedI was last triggered. */ ! # ifdef FEAT_INS_EXPAND varnumber_T b_last_changedtick_pum; /* b:changedtick when TextChangedP was last triggered. */ - # endif #endif int b_saving; /* Set to TRUE if we are in the middle of --- 1982,1992 ---- incremented for each change, also for undo */ #define CHANGEDTICK(buf) ((buf)->b_ct_di.di_tv.vval.v_number) varnumber_T b_last_changedtick; /* b:changedtick when TextChanged or TextChangedI was last triggered. */ ! #ifdef FEAT_INS_EXPAND varnumber_T b_last_changedtick_pum; /* b:changedtick when TextChangedP was last triggered. */ #endif int b_saving; /* Set to TRUE if we are in the middle of *************** *** 2171,2179 **** char_u *b_p_fenc; /* 'fileencoding' */ #endif char_u *b_p_ff; /* 'fileformat' */ - #ifdef FEAT_AUTOCMD char_u *b_p_ft; /* 'filetype' */ - #endif char_u *b_p_fo; /* 'formatoptions' */ char_u *b_p_flp; /* 'formatlistpat' */ int b_p_inf; /* 'infercase' */ --- 2165,2171 ---- *************** *** 2448,2459 **** #endif #define SNAP_HELP_IDX 0 ! #ifdef FEAT_AUTOCMD ! # define SNAP_AUCMD_IDX 1 ! # define SNAP_COUNT 2 ! #else ! # define SNAP_COUNT 1 ! #endif /* * Tab pages point to the top frame of each tab page. --- 2440,2447 ---- #endif #define SNAP_HELP_IDX 0 ! #define SNAP_AUCMD_IDX 1 ! #define SNAP_COUNT 2 /* * Tab pages point to the top frame of each tab page. *************** *** 2642,2651 **** win_T *w_prev; /* link to previous window */ win_T *w_next; /* link to next window */ - #ifdef FEAT_AUTOCMD int w_closing; /* window is being closed, don't let autocommands close it too. */ - #endif frame_T *w_frame; /* frame containing this window */ --- 2630,2637 ---- *************** *** 2676,2685 **** */ linenr_T w_topline; /* buffer line number of the line at the top of the window */ - #ifdef FEAT_AUTOCMD char w_topline_was_set; /* flag set to TRUE when topline is set, e.g. by winrestview() */ - #endif #ifdef FEAT_DIFF int w_topfill; /* number of filler lines above w_topline */ int w_old_topfill; /* w_topfill at last redraw */ --- 2662,2669 ---- *************** *** 2973,2982 **** int block_mode; /* current operator is Visual block mode */ colnr_T start_vcol; /* start col for block mode operator */ colnr_T end_vcol; /* end col for block mode operator */ - #ifdef FEAT_AUTOCMD long prev_opcount; /* ca.opcount saved for K_CURSORHOLD */ long prev_count0; /* ca.count0 saved for K_CURSORHOLD */ - #endif } oparg_T; /* --- 2957,2964 ---- *************** *** 3160,3177 **** /* * Struct to save values in before executing autocommands for a buffer that is ! * not the current buffer. Without FEAT_AUTOCMD only "curbuf" is remembered. */ typedef struct { buf_T *save_curbuf; /* saved curbuf */ - #ifdef FEAT_AUTOCMD int use_aucmd_win; /* using aucmd_win */ win_T *save_curwin; /* saved curwin */ win_T *new_curwin; /* new curwin */ bufref_T new_curbuf; /* new curbuf */ char_u *globaldir; /* saved value of globaldir */ - #endif } aco_save_T; /* --- 3142,3157 ---- /* * Struct to save values in before executing autocommands for a buffer that is ! * not the current buffer. */ typedef struct { buf_T *save_curbuf; /* saved curbuf */ int use_aucmd_win; /* using aucmd_win */ win_T *save_curwin; /* saved curwin */ win_T *new_curwin; /* new curwin */ bufref_T new_curbuf; /* new curbuf */ char_u *globaldir; /* saved value of globaldir */ } aco_save_T; /* *** ../vim-8.0.1563/src/syntax.c 2018-03-03 20:02:13.700760141 +0100 --- src/syntax.c 2018-03-04 16:22:32.264500903 +0100 *************** *** 6420,6430 **** if (old_value != NULL) old_value = vim_strsave(old_value); - #ifdef FEAT_AUTOCMD /* Apply the "syntax" autocommand event, this finds and loads the syntax * file. */ apply_autocmds(EVENT_SYNTAX, eap->arg, curbuf->b_fname, TRUE, curbuf); - #endif /* move value of b:current_syntax to w:current_syntax */ new_value = get_var_value((char_u *)"b:current_syntax"); --- 6420,6428 ---- *************** *** 6995,7004 **** CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), #endif - #ifdef FEAT_AUTOCMD CENT("MatchParen term=reverse ctermbg=Cyan", "MatchParen term=reverse ctermbg=Cyan guibg=Cyan"), - #endif #ifdef FEAT_GUI "Normal gui=NONE", #endif --- 6993,7000 ---- *************** *** 7089,7098 **** CENT("ColorColumn term=reverse ctermbg=DarkRed", "ColorColumn term=reverse ctermbg=DarkRed guibg=DarkRed"), #endif - #ifdef FEAT_AUTOCMD CENT("MatchParen term=reverse ctermbg=DarkCyan", "MatchParen term=reverse ctermbg=DarkCyan guibg=DarkCyan"), - #endif #ifdef FEAT_CONCEAL CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), --- 7085,7092 ---- *************** *** 7233,7241 **** sprintf((char *)buf, "colors/%s.vim", name); retval = source_runtime(buf, DIP_START + DIP_OPT); vim_free(buf); - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf); - #endif } recursive = FALSE; --- 7227,7233 ---- *** ../vim-8.0.1563/src/tag.c 2018-02-10 18:45:21.096821957 +0100 --- src/tag.c 2018-03-04 16:22:52.508371509 +0100 *************** *** 1017,1023 **** } } ! #ifdef FEAT_AUTOCMD /* Let the SwapExists event know what tag we are jumping to. */ vim_snprintf((char *)IObuff, IOSIZE, ":ta %s\r", name); set_vim_var_string(VV_SWAPCOMMAND, IObuff, -1); --- 1017,1023 ---- } } ! #if defined(FEAT_EVAL) /* Let the SwapExists event know what tag we are jumping to. */ vim_snprintf((char *)IObuff, IOSIZE, ":ta %s\r", name); set_vim_var_string(VV_SWAPCOMMAND, IObuff, -1); *************** *** 1028,1034 **** */ i = jumpto_tag(matches[cur_match], forceit, type != DT_CSCOPE); ! #ifdef FEAT_AUTOCMD set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); #endif --- 1028,1034 ---- */ i = jumpto_tag(matches[cur_match], forceit, type != DT_CSCOPE); ! #if defined(FEAT_EVAL) set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); #endif *************** *** 3174,3184 **** * file. Also accept a file name for which there is a matching BufReadCmd * autocommand event (e.g., http://sys/file). */ ! if (mch_getperm(fname) < 0 ! #ifdef FEAT_AUTOCMD ! && !has_autocmd(EVENT_BUFREADCMD, fname, NULL) ! #endif ! ) { retval = NOTAGFILE; vim_free(nofile_fname); --- 3174,3180 ---- * file. Also accept a file name for which there is a matching BufReadCmd * autocommand event (e.g., http://sys/file). */ ! if (mch_getperm(fname) < 0 && !has_autocmd(EVENT_BUFREADCMD, fname, NULL)) { retval = NOTAGFILE; vim_free(nofile_fname); *** ../vim-8.0.1563/src/term.c 2018-03-03 21:29:46.918813940 +0100 --- src/term.c 2018-03-04 16:23:16.568217764 +0100 *************** *** 1985,1991 **** scroll_region_reset(); /* In case Rows changed */ check_map_keycodes(); /* check mappings for terminal codes used */ - #ifdef FEAT_AUTOCMD { bufref_T old_curbuf; --- 1985,1990 ---- *************** *** 2003,2009 **** if (bufref_valid(&old_curbuf)) curbuf = old_curbuf.br_buf; } - #endif } #ifdef FEAT_TERMRESPONSE --- 2002,2007 ---- *************** *** 4515,4523 **** LOG_TR("Received U7 status"); u7_status = STATUS_GOT; - # ifdef FEAT_AUTOCMD did_cursorhold = TRUE; - # endif if (col == 2) aw = "single"; else if (col == 3) --- 4513,4519 ---- *************** *** 4560,4568 **** LOG_TR("Received CRV response"); crv_status = STATUS_GOT; - # ifdef FEAT_AUTOCMD did_cursorhold = TRUE; - # endif /* If this code starts with CSI, you can bet that the * terminal uses 8-bit codes. */ --- 4556,4562 ---- *************** *** 4702,4711 **** # ifdef FEAT_EVAL set_vim_var_string(VV_TERMRESPONSE, tp, slen); # endif - # ifdef FEAT_AUTOCMD apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, FALSE, curbuf); - # endif key_name[0] = (int)KS_EXTRA; key_name[1] = (int)KE_IGNORE; } --- 4696,4703 ---- *** ../vim-8.0.1563/src/terminal.c 2018-02-27 16:29:24.437343097 +0100 --- src/terminal.c 2018-03-04 16:23:33.952106707 +0100 *************** *** 38,43 **** --- 38,47 ---- * in tl_scrollback are no longer used. * * TODO: + * - What to store in a session file? Shell at the prompt would be OK to + * restore, but others may not. Open the window and let the user start the + * command? Also see #2650. + * - Adding WinBar to terminal window doesn't display, text isn't shifted down. * - When using 'termguicolors' still use the 16 ANSI colors as-is. Helps for * a job that uses 16 colors while Vim is using > 256. * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito *************** *** 46,69 **** * - after resizing windows overlap. (Boris Staletic, #2164) * - Redirecting output does not work on MS-Windows, Test_terminal_redir_file() * is disabled. * - cursor blinks in terminal on widows with a timer. (xtal8, #2142) - * - What to store in a session file? Shell at the prompt would be OK to - * restore, but others may not. Open the window and let the user start the - * command? Also see #2650. * - When closing gvim with an active terminal buffer, the dialog suggests * saving the buffer. Should say something else. (Manas Thakur, #2215) * Also: #2223 * - Termdebug does not work when Vim build with mzscheme. gdb hangs. * - MS-Windows GUI: WinBar has tearoff item - * - Adding WinBar to terminal window doesn't display, text isn't shifted down. * - MS-Windows GUI: still need to type a key after shell exits? #1924 * - After executing a shell command the status line isn't redraw. * - implement term_setsize() * - add test for giving error for invalid 'termsize' value. * - support minimal size when 'termsize' is "rows*cols". * - support minimal size when 'termsize' is empty? - * - if the job in the terminal does not support the mouse, we can use the - * mouse in the Terminal window for copy/paste and scrolling. * - GUI: when using tabs, focus in terminal, click on tab does not work. * - GUI: when 'confirm' is set and trying to exit Vim, dialog offers to save * changes to "!shell". --- 50,69 ---- * - after resizing windows overlap. (Boris Staletic, #2164) * - Redirecting output does not work on MS-Windows, Test_terminal_redir_file() * is disabled. + * - if the job in the terminal does not support the mouse, we can use the + * mouse in the Terminal window for copy/paste and scrolling. * - cursor blinks in terminal on widows with a timer. (xtal8, #2142) * - When closing gvim with an active terminal buffer, the dialog suggests * saving the buffer. Should say something else. (Manas Thakur, #2215) * Also: #2223 * - Termdebug does not work when Vim build with mzscheme. gdb hangs. * - MS-Windows GUI: WinBar has tearoff item * - MS-Windows GUI: still need to type a key after shell exits? #1924 * - After executing a shell command the status line isn't redraw. * - implement term_setsize() * - add test for giving error for invalid 'termsize' value. * - support minimal size when 'termsize' is "rows*cols". * - support minimal size when 'termsize' is empty? * - GUI: when using tabs, focus in terminal, click on tab does not work. * - GUI: when 'confirm' is set and trying to exit Vim, dialog offers to save * changes to "!shell". *************** *** 506,519 **** * a deadlock if the job is waiting for Vim to read. */ channel_set_nonblock(term->tl_job->jv_channel, PART_IN); - #ifdef FEAT_AUTOCMD if (!opt->jo_hidden) { ++curbuf->b_locked; apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); --curbuf->b_locked; } - #endif if (old_curbuf != NULL) { --- 506,517 ---- *************** *** 938,946 **** #ifdef FEAT_DND case K_DROP: return 0; #endif - #ifdef FEAT_AUTOCMD case K_CURSORHOLD: return 0; - #endif case K_PS: vterm_keyboard_start_paste(vterm); other = TRUE; break; --- 936,942 ---- *** ../vim-8.0.1563/src/ui.c 2018-03-03 19:51:52.868688122 +0100 --- src/ui.c 2018-03-04 17:01:25.333344757 +0100 *************** *** 3299,3311 **** last_time = time(NULL); } - #ifdef FEAT_AUTOCMD /* * Fire the focus gained/lost autocommand. */ need_redraw |= apply_autocmds(in_focus ? EVENT_FOCUSGAINED : EVENT_FOCUSLOST, NULL, NULL, FALSE, curbuf); - #endif if (need_redraw) { --- 3299,3309 ---- *************** *** 3339,3345 **** } #endif ! #if defined(FEAT_MBYTE) || defined(PROTO) /* * Save current Input Method status to specified place. */ --- 3337,3343 ---- } #endif ! #if defined(HAVE_INPUT_METHOD) || defined(PROTO) /* * Save current Input Method status to specified place. */ *** ../vim-8.0.1563/src/undo.c 2018-02-10 18:45:21.096821957 +0100 --- src/undo.c 2018-03-04 16:24:13.939851333 +0100 *************** *** 424,430 **** term_change_in_curbuf(); #endif - #ifdef FEAT_AUTOCMD /* * Saving text for undo means we are going to make a change. Give a * warning for a read-only file before making the change, so that the --- 424,429 ---- *************** *** 439,445 **** EMSG(_("E881: Line count changed unexpectedly")); return FAIL; } - #endif } #ifdef U_DEBUG --- 438,443 ---- *************** *** 2631,2641 **** int empty_buffer; /* buffer became empty */ u_header_T *curhead = curbuf->b_u_curhead; - #ifdef FEAT_AUTOCMD /* Don't want autocommands using the undo structures here, they are * invalid till the end. */ block_autocmds(); - #endif #ifdef U_DEBUG u_check(FALSE); --- 2629,2637 ---- *************** *** 2664,2672 **** if (top > curbuf->b_ml.ml_line_count || top >= bot || bot > curbuf->b_ml.ml_line_count + 1) { - #ifdef FEAT_AUTOCMD unblock_autocmds(); - #endif IEMSG(_("E438: u_undo: line numbers wrong")); changed(); /* don't want UNCHANGED now */ return; --- 2660,2666 ---- *************** *** 2891,2899 **** * the undone/redone change. */ curbuf->b_u_time_cur = curhead->uh_time; - #ifdef FEAT_AUTOCMD unblock_autocmds(); - #endif #ifdef U_DEBUG u_check(FALSE); #endif --- 2885,2891 ---- *** ../vim-8.0.1563/src/userfunc.c 2018-02-11 19:06:20.265418939 +0100 --- src/userfunc.c 2018-03-04 16:24:26.655770151 +0100 *************** *** 1372,1378 **** else fp = find_func(rfname); - #ifdef FEAT_AUTOCMD /* Trigger FuncUndefined event, may load the function. */ if (fp == NULL && apply_autocmds(EVENT_FUNCUNDEFINED, --- 1372,1377 ---- *************** *** 1382,1388 **** /* executed an autocommand, search for the function again */ fp = find_func(rfname); } - #endif /* Try loading a package. */ if (fp == NULL && script_autoload(rfname, TRUE) && !aborting()) { --- 1381,1386 ---- *** ../vim-8.0.1563/src/version.c 2018-03-03 21:29:46.922813914 +0100 --- src/version.c 2018-03-04 18:05:39.925129032 +0100 *************** *** 78,88 **** #else "-arabic", #endif - #ifdef FEAT_AUTOCMD "+autocmd", - #else - "-autocmd", - #endif #ifdef FEAT_AUTOSERVERNAME "+autoservername", #else --- 78,84 ---- *** ../vim-8.0.1563/src/window.c 2018-02-20 21:44:39.394348788 +0100 --- src/window.c 2018-03-04 16:27:57.818423794 +0100 *************** *** 1437,1449 **** if (count > 1) last_status(TRUE); - #ifdef FEAT_AUTOCMD /* * Don't execute autocommands while creating the windows. Must do that * when putting the buffers in the windows. */ block_autocmds(); - #endif /* todo is number of windows left to create */ for (todo = count - 1; todo > 0; --todo) --- 1437,1447 ---- *************** *** 1461,1469 **** break; } - #ifdef FEAT_AUTOCMD unblock_autocmds(); - #endif /* return actual number of windows */ return (count - todo); --- 1459,1465 ---- *************** *** 2104,2122 **** win_T *wp; tabpage_T *tp, *nexttp; int h = tabline_height(); - #ifdef FEAT_AUTOCMD int count = tabpage_index(NULL); - #endif ++RedrawingDisabled; for (wp = firstwin; wp != NULL && !ONE_WINDOW; ) { if (wp->w_buffer == buf && (!keep_curwin || wp != curwin) ! #ifdef FEAT_AUTOCMD ! && !(wp->w_closing || wp->w_buffer->b_locked > 0) ! #endif ! ) { if (win_close(wp, FALSE) == FAIL) /* If closing the window fails give up, to avoid looping --- 2100,2113 ---- win_T *wp; tabpage_T *tp, *nexttp; int h = tabline_height(); int count = tabpage_index(NULL); ++RedrawingDisabled; for (wp = firstwin; wp != NULL && !ONE_WINDOW; ) { if (wp->w_buffer == buf && (!keep_curwin || wp != curwin) ! && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { if (win_close(wp, FALSE) == FAIL) /* If closing the window fails give up, to avoid looping *************** *** 2137,2146 **** if (tp != curtab) for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) if (wp->w_buffer == buf ! #ifdef FEAT_AUTOCMD ! && !(wp->w_closing || wp->w_buffer->b_locked > 0) ! #endif ! ) { win_close_othertab(wp, FALSE, tp); --- 2128,2134 ---- if (tp != curtab) for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) if (wp->w_buffer == buf ! && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { win_close_othertab(wp, FALSE, tp); *************** *** 2153,2162 **** --RedrawingDisabled; - #ifdef FEAT_AUTOCMD if (count != tabpage_index(NULL)) apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); - #endif redraw_tabline = TRUE; if (h != tabline_height()) --- 2141,2148 ---- *************** *** 2181,2187 **** int one_window(void) { - #ifdef FEAT_AUTOCMD win_T *wp; int seen_one = FALSE; --- 2167,2172 ---- *************** *** 2195,2203 **** } } return TRUE; - #else - return ONE_WINDOW; - #endif } /* --- 2180,2185 ---- *************** *** 2212,2220 **** { if (ONE_WINDOW) { - #ifdef FEAT_AUTOCMD buf_T *old_curbuf = curbuf; - #endif /* * Closing the last window in a tab page. First go to another tab --- 2194,2200 ---- *************** *** 2239,2251 **** } /* Since goto_tabpage_tp above did not trigger *Enter autocommands, do * that now. */ - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf); if (old_curbuf != curbuf) apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); - #endif return TRUE; } return FALSE; --- 2219,2229 ---- *************** *** 2262,2270 **** win_close(win_T *win, int free_buf) { win_T *wp; - #ifdef FEAT_AUTOCMD int other_buffer = FALSE; - #endif int close_curwin = FALSE; int dir; int help_window = FALSE; --- 2240,2246 ---- *************** *** 2277,2283 **** return FAIL; } - #ifdef FEAT_AUTOCMD if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_locked > 0)) return FAIL; /* window is already being closed */ --- 2253,2258 ---- *************** *** 2291,2297 **** EMSG(_("E814: Cannot close window, only autocmd window would remain")); return FAIL; } - #endif /* When closing the last window in a tab page first go to another tab page * and then close the window and the tab page to avoid that curwin and --- 2266,2271 ---- *************** *** 2306,2312 **** else clear_snapshot(curtab, SNAP_HELP_IDX); - #ifdef FEAT_AUTOCMD if (win == curwin) { /* --- 2280,2285 ---- *************** *** 2337,2349 **** win->w_closing = FALSE; if (last_window()) return FAIL; ! # ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting()) return FAIL; - # endif - } #endif #ifdef FEAT_GUI /* Avoid trouble with scrollbars that are going to be deleted in --- 2310,2321 ---- win->w_closing = FALSE; if (last_window()) return FAIL; ! #ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting()) return FAIL; #endif + } #ifdef FEAT_GUI /* Avoid trouble with scrollbars that are going to be deleted in *************** *** 2366,2379 **** bufref_T bufref; set_bufref(&bufref, curbuf); - #ifdef FEAT_AUTOCMD win->w_closing = TRUE; - #endif close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE); - #ifdef FEAT_AUTOCMD if (win_valid_any_tab(win)) win->w_closing = FALSE; - #endif /* Make sure curbuf is valid. It can become invalid if 'bufhidden' is * "wipe". */ if (!bufref_valid(&bufref)) --- 2338,2347 ---- *************** *** 2455,2465 **** if (close_curwin) { win_enter_ext(wp, FALSE, TRUE, FALSE, TRUE, TRUE); - #ifdef FEAT_AUTOCMD if (other_buffer) /* careful: after this wp and win may be invalid! */ apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); - #endif } /* --- 2423,2431 ---- *************** *** 2498,2510 **** tabpage_T *ptp = NULL; int free_tp = FALSE; - #ifdef FEAT_AUTOCMD /* Get here with win->w_buffer == NULL when win_close() detects the tab * page changed. */ if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_locked > 0)) return; /* window is already being closed */ - #endif if (win->w_buffer != NULL) /* Close the link to the buffer. */ --- 2464,2474 ---- *************** *** 2586,2598 **** while (first_tabpage->tp_next != NULL) tabpage_close(TRUE); - # ifdef FEAT_AUTOCMD if (aucmd_win != NULL) { (void)win_free_mem(aucmd_win, &dummy, NULL); aucmd_win = NULL; } - # endif while (firstwin != NULL) (void)win_free_mem(firstwin, &dummy, NULL); --- 2550,2560 ---- *************** *** 3331,3341 **** if (one_window()) { ! if (message ! #ifdef FEAT_AUTOCMD ! && !autocmd_busy ! #endif ! ) MSG(_(m_onlyone)); return; } --- 3293,3299 ---- if (one_window()) { ! if (message && !autocmd_busy) MSG(_(m_onlyone)); return; } *************** *** 3349,3374 **** /* Check if it's allowed to abandon this window */ r = can_abandon(wp->w_buffer, forceit); - #ifdef FEAT_AUTOCMD if (!win_valid(wp)) /* autocommands messed wp up */ { nextwp = firstwin; continue; } - #endif if (!r) { #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if (message && (p_confirm || cmdmod.confirm) && p_write) { dialog_changed(wp->w_buffer, FALSE); - # ifdef FEAT_AUTOCMD if (!win_valid(wp)) /* autocommands messed wp up */ { nextwp = firstwin; continue; } - # endif } if (bufIsChanged(wp->w_buffer)) #endif --- 3307,3328 ---- *************** *** 3443,3449 **** return OK; } - #if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Init "aucmd_win". This can only be done after the first * window is fully initialized, thus it can't be in win_alloc_first(). --- 3397,3402 ---- *************** *** 3459,3465 **** new_frame(aucmd_win); } } - #endif /* * Allocate the first window or the first window in a new tab page. --- 3412,3417 ---- *************** *** 3663,3674 **** #endif redraw_all_later(CLEAR); - #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABNEW, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf); - #endif return OK; } --- 3615,3624 ---- *************** *** 3710,3730 **** if (count > p_tpm) count = p_tpm; - #ifdef FEAT_AUTOCMD /* * Don't execute autocommands while creating the tab pages. Must do that * when putting the buffers in the windows. */ block_autocmds(); - #endif for (todo = count - 1; todo > 0; --todo) if (win_new_tabpage(0) == FAIL) break; - #ifdef FEAT_AUTOCMD unblock_autocmds(); - #endif /* return actual number of tab pages */ return (count - todo); --- 3660,3676 ---- *************** *** 3841,3847 **** tabpage_T *tp = curtab; reset_VIsual_and_resel(); /* stop Visual mode */ - #ifdef FEAT_AUTOCMD if (trigger_leave_autocmds) { if (new_curbuf != curbuf) --- 3787,3792 ---- *************** *** 3857,3863 **** if (curtab != tp) return FAIL; } - #endif #if defined(FEAT_GUI) /* Remove the scrollbars. They may be added back later. */ if (gui.in_use) --- 3802,3807 ---- *************** *** 3929,3935 **** gui_may_update_scrollbars(); #endif - #ifdef FEAT_AUTOCMD /* Apply autocommands after updating the display, when 'rows' and * 'columns' have been set correctly. */ if (trigger_enter_autocmds) --- 3873,3878 ---- *************** *** 3938,3944 **** if (old_curbuf != curbuf) apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); } - #endif redraw_all_later(CLEAR); } --- 3881,3886 ---- *************** *** 4131,4140 **** text_locked_msg(); return; } - #ifdef FEAT_AUTOCMD if (curbuf_locked()) return; - #endif if (wp->w_buffer != curbuf) reset_VIsual_and_resel(); --- 4073,4080 ---- *************** *** 4337,4350 **** int trigger_enter_autocmds UNUSED, int trigger_leave_autocmds UNUSED) { - #ifdef FEAT_AUTOCMD int other_buffer = FALSE; - #endif if (wp == curwin && !curwin_invalid) /* nothing to do */ return; - #ifdef FEAT_AUTOCMD if (!curwin_invalid && trigger_leave_autocmds) { /* --- 4277,4287 ---- *************** *** 4360,4372 **** apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf); if (!win_valid(wp)) return; ! # ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting()) return; - # endif - } #endif /* sync undo before leaving the current buffer */ if (undo_sync && curbuf != wp->w_buffer) --- 4297,4308 ---- apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf); if (!win_valid(wp)) return; ! #ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting()) return; #endif + } /* sync undo before leaving the current buffer */ if (undo_sync && curbuf != wp->w_buffer) *************** *** 4417,4423 **** shorten_fnames(TRUE); } - #ifdef FEAT_AUTOCMD if (trigger_new_autocmds) apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf); if (trigger_enter_autocmds) --- 4353,4358 ---- *************** *** 4426,4432 **** if (other_buffer) apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); } - #endif #ifdef FEAT_TITLE maketitle(); --- 4361,4366 ---- *************** *** 4544,4555 **** init_var_dict(new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE); #endif - #ifdef FEAT_AUTOCMD /* Don't execute autocommands while the window is not properly * initialized yet. gui_create_scrollbar() may trigger a FocusGained * event. */ block_autocmds(); ! #endif /* * link the window in the window list */ --- 4478,4488 ---- init_var_dict(new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE); #endif /* Don't execute autocommands while the window is not properly * initialized yet. gui_create_scrollbar() may trigger a FocusGained * event. */ block_autocmds(); ! /* * link the window in the window list */ *************** *** 4585,4593 **** #ifdef FEAT_FOLDING foldInitWin(new_wp); #endif - #ifdef FEAT_AUTOCMD unblock_autocmds(); - #endif #ifdef FEAT_SEARCH_EXTRA new_wp->w_match_head = NULL; new_wp->w_next_match_id = 4; --- 4518,4524 ---- *************** *** 4614,4624 **** /* reduce the reference count to the argument list. */ alist_unlink(wp->w_alist); - #ifdef FEAT_AUTOCMD /* Don't execute autocommands while the window is halfway being deleted. * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */ block_autocmds(); - #endif #ifdef FEAT_LUA lua_window_free(wp); --- 4545,4553 ---- *************** *** 4708,4730 **** vim_free(wp->w_p_cc_cols); #endif - #ifdef FEAT_AUTOCMD if (wp != aucmd_win) - #endif win_remove(wp, tp); - #ifdef FEAT_AUTOCMD if (autocmd_busy) { wp->w_next = au_pending_free_win; au_pending_free_win = wp; } else - #endif vim_free(wp); - #ifdef FEAT_AUTOCMD unblock_autocmds(); - #endif } /* --- 4637,4653 ---- *************** *** 6426,6436 **** # ifdef FEAT_QUICKFIX || wp->w_p_pvw # endif ! ) || wp == curwin) ! # ifdef FEAT_AUTOCMD ! && wp != aucmd_win ! # endif ! ) ++count; return (count <= 1); } --- 6349,6355 ---- # ifdef FEAT_QUICKFIX || wp->w_p_pvw # endif ! ) || wp == curwin) && wp != aucmd_win) ++count; return (count <= 1); } *************** *** 6613,6621 **** tabpage_T *tp, int no_display) { - # ifdef FEAT_AUTOCMD block_autocmds(); - # endif *save_curwin = curwin; if (tp != NULL) { --- 6532,6538 ---- *************** *** 6667,6675 **** curwin = save_curwin; curbuf = curwin->w_buffer; } - # ifdef FEAT_AUTOCMD unblock_autocmds(); - # endif } /* --- 6584,6590 ---- *************** *** 6679,6687 **** void switch_buffer(bufref_T *save_curbuf, buf_T *buf) { - # ifdef FEAT_AUTOCMD block_autocmds(); - # endif set_bufref(save_curbuf, curbuf); --curbuf->b_nwindows; curbuf = buf; --- 6594,6600 ---- *************** *** 6695,6703 **** void restore_buffer(bufref_T *save_curbuf) { - # ifdef FEAT_AUTOCMD unblock_autocmds(); - # endif /* Check for valid buffer, just in case. */ if (bufref_valid(save_curbuf)) { --- 6608,6614 ---- *** ../vim-8.0.1563/src/version.c 2018-03-03 21:29:46.922813914 +0100 --- src/version.c 2018-03-04 18:05:39.925129032 +0100 *************** *** 780,781 **** --- 776,779 ---- { /* Add new patch number below this line */ + /**/ + 1564, /**/ -- SECOND SOLDIER: It could be carried by an African swallow! FIRST SOLDIER: Oh yes! An African swallow maybe ... but not a European swallow. that's my point. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///