To: vim_dev@googlegroups.com Subject: Patch 8.0.1650 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1650 Problem: Too many #ifdefs. Solution: Graduate FEAT_LISTCMDS, no reason to leave out buffer commands. Files: runtime/doc/various.txt, src/buffer.c, src/charset.c, src/evalfunc.c, src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/version.c, src/feature.h *** ../vim-8.0.1649/runtime/doc/various.txt 2018-03-14 21:38:57.908996048 +0100 --- runtime/doc/various.txt 2018-03-29 15:24:19.051266757 +0200 *************** *** 374,387 **** *+iconv/dyn* Likewise |iconv-dynamic| |/dyn| N *+insert_expand* |insert_expand| Insert mode completion m *+job* starting and stopping jobs |job| ! N *+jumplist* |jumplist| B *+keymap* |'keymap'| N *+lambda* |lambda| and |closure| B *+langmap* |'langmap'| N *+libcall* |libcall()| N *+linebreak* |'linebreak'|, |'breakat'| and |'showbreak'| N *+lispindent* |'lisp'| ! N *+listcmds* Vim commands for the list of buffers |buffer-hidden| and argument list |:argdelete| N *+localmap* Support for mappings local to a buffer |:map-local| m *+lua* |Lua| interface --- 377,390 ---- *+iconv/dyn* Likewise |iconv-dynamic| |/dyn| N *+insert_expand* |insert_expand| Insert mode completion m *+job* starting and stopping jobs |job| ! S *+jumplist* |jumplist| B *+keymap* |'keymap'| N *+lambda* |lambda| and |closure| B *+langmap* |'langmap'| N *+libcall* |libcall()| N *+linebreak* |'linebreak'|, |'breakat'| and |'showbreak'| N *+lispindent* |'lisp'| ! T *+listcmds* Vim commands for the list of buffers |buffer-hidden| and argument list |:argdelete| N *+localmap* Support for mappings local to a buffer |:map-local| m *+lua* |Lua| interface *** ../vim-8.0.1649/src/buffer.c 2018-03-25 18:19:47.221066088 +0200 --- src/buffer.c 2018-03-29 15:27:51.642146112 +0200 *************** *** 27,39 **** #include "vim.h" - #if defined(FEAT_CMDL_COMPL) || defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) static char_u *buflist_match(regmatch_T *rmp, buf_T *buf, int ignore_case); - # define HAVE_BUFLIST_MATCH static char_u *fname_match(regmatch_T *rmp, char_u *name, int ignore_case); - #endif static void buflist_setfpos(buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options); - static wininfo_T *find_wininfo(buf_T *buf, int skip_diff_buffer); #ifdef UNIX static buf_T *buflist_findname_stat(char_u *ffname, stat_T *st); static int otherfile_buf(buf_T *buf, char_u *ffname, stat_T *stp); --- 27,35 ---- *************** *** 948,954 **** } } - #if defined(FEAT_LISTCMDS) || defined(FEAT_TERMINAL) || defined(PROTO) /* * Go to another buffer. Handles the result of the ATTENTION dialog. */ --- 944,949 ---- *************** *** 959,1000 **** int dir, int count) { ! # if defined(HAS_SWAP_EXISTS_ACTION) bufref_T old_curbuf; set_bufref(&old_curbuf, curbuf); swap_exists_action = SEA_DIALOG; ! # endif (void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO, start, dir, count, eap->forceit); ! # 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 * aborting() returns FALSE when closing a window. */ enter_cleanup(&cs); ! # endif /* Quitting means closing the split window, nothing else. */ win_close(curwin, TRUE); 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); ! # endif } else handle_swap_exists(&old_curbuf); - # endif - } #endif #if defined(HAS_SWAP_EXISTS_ACTION) || defined(PROTO) /* --- 954,994 ---- int dir, int count) { ! #if defined(HAS_SWAP_EXISTS_ACTION) bufref_T old_curbuf; set_bufref(&old_curbuf, curbuf); swap_exists_action = SEA_DIALOG; ! #endif (void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO, start, dir, count, eap->forceit); ! #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 * aborting() returns FALSE when closing a window. */ enter_cleanup(&cs); ! # endif /* Quitting means closing the split window, nothing else. */ win_close(curwin, TRUE); 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); ! # endif } else handle_swap_exists(&old_curbuf); #endif + } #if defined(HAS_SWAP_EXISTS_ACTION) || defined(PROTO) /* *************** *** 1072,1078 **** } #endif - #if defined(FEAT_LISTCMDS) || defined(PROTO) /* * do_bufdel() - delete or unload buffer(s) * --- 1066,1071 ---- *************** *** 1199,1208 **** return errormsg; } - #endif /* FEAT_LISTCMDS */ - - #if defined(FEAT_LISTCMDS) || defined(FEAT_PYTHON) \ - || defined(FEAT_PYTHON3) || defined(PROTO) static int empty_curbuf(int close_others, int forceit, int action); --- 1192,1197 ---- *************** *** 1359,1365 **** need_mouse_correct = TRUE; #endif - #ifdef FEAT_LISTCMDS /* * delete buffer buf from memory and/or the list */ --- 1348,1353 ---- *************** *** 1377,1383 **** if (!forceit && bufIsChanged(buf)) { ! # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if ((p_confirm || cmdmod.confirm) && p_write) { dialog_changed(buf, FALSE); --- 1365,1371 ---- if (!forceit && bufIsChanged(buf)) { ! #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if ((p_confirm || cmdmod.confirm) && p_write) { dialog_changed(buf, FALSE); *************** *** 1391,1397 **** return FAIL; } else ! # endif { EMSGN(_("E89: No write since last change for buffer %ld (add ! to override)"), buf->b_fnum); --- 1379,1385 ---- return FAIL; } else ! #endif { EMSGN(_("E89: No write since last change for buffer %ld (add ! to override)"), buf->b_fnum); *************** *** 1557,1563 **** if (win_split(0, 0) == FAIL) return FAIL; } - #endif /* go to current buffer - nothing to do */ if (buf == curbuf) --- 1545,1550 ---- *************** *** 1590,1601 **** /* Go to the other buffer. */ set_curbuf(buf, action); - #if defined(FEAT_LISTCMDS) if (action == DOBUF_SPLIT) { RESET_BINDING(curwin); /* reset 'scrollbind' and 'cursorbind' */ } - #endif #if defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ --- 1577,1586 ---- *************** *** 1604,1610 **** return OK; } - #endif /* * Set current buffer to "buf". Executes autocommands and closes current --- 1589,1594 ---- *************** *** 2411,2418 **** return NULL; } - #if defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) \ - || defined(PROTO) /* * Find file in buffer list by a regexp pattern. * Return fnum of the found buffer. --- 2395,2400 ---- *************** *** 2534,2540 **** EMSG2(_("E94: No matching buffer for %s"), pattern); return match; } - #endif #if defined(FEAT_CMDL_COMPL) || defined(PROTO) --- 2516,2521 ---- *************** *** 2644,2650 **** #endif /* FEAT_CMDL_COMPL */ - #ifdef HAVE_BUFLIST_MATCH /* * Check for a match on the file name for buffer "buf" with regprog "prog". */ --- 2625,2630 ---- *************** *** 2695,2701 **** return match; } - #endif /* * Find a file in the buffer list by buffer number. --- 2675,2680 ---- *************** *** 2940,2946 **** return buflist_findfpos(buf)->lnum; } - #if defined(FEAT_LISTCMDS) || defined(PROTO) /* * List all known file names (for :files and :buffers command). */ --- 2919,2924 ---- *************** *** 3024,3030 **** ui_breakcheck(); } } - #endif /* * Get file name and line number for file 'fnum'. --- 3002,3007 ---- *************** *** 5095,5101 **** vim_free(opened); } - # if defined(FEAT_LISTCMDS) || defined(PROTO) /* * Open a window for a number of buffers. */ --- 5072,5077 ---- *************** *** 5300,5306 **** } } } - # endif /* FEAT_LISTCMDS */ static int chk_modeline(linenr_T, int); --- 5276,5281 ---- *** ../vim-8.0.1649/src/charset.c 2017-10-28 16:07:29.191602155 +0200 --- src/charset.c 2018-03-29 15:28:07.738061393 +0200 *************** *** 1787,1793 **** return p; } - #if defined(FEAT_LISTCMDS) || defined(FEAT_SIGNS) || defined(PROTO) /* * skiptowhite_esc: Like skiptowhite(), but also skip escaped chars */ --- 1787,1792 ---- *************** *** 1802,1808 **** } return p; } - #endif /* * Getdigits: Get a number from a string and skip over it. --- 1801,1806 ---- *** ../vim-8.0.1649/src/evalfunc.c 2018-03-22 23:03:56.110362003 +0100 --- src/evalfunc.c 2018-03-29 15:28:13.754029733 +0200 *************** *** 5980,5988 **** #ifdef FEAT_LISP "lispindent", #endif - #ifdef FEAT_LISTCMDS "listcmds", - #endif #ifdef FEAT_LOCALMAP "localmap", #endif --- 5980,5986 ---- *** ../vim-8.0.1649/src/ex_cmds.c 2018-03-04 20:14:08.244064367 +0100 --- src/ex_cmds.c 2018-03-29 15:28:52.361826600 +0200 *************** *** 3745,3754 **** fname_case(sfname, 0); /* set correct case for sfname */ #endif - #ifdef FEAT_LISTCMDS if ((flags & ECMD_ADDBUF) && (ffname == NULL || *ffname == NUL)) goto theend; - #endif if (ffname == NULL) other_file = TRUE; --- 3745,3752 ---- *************** *** 3830,3838 **** */ if (other_file) { - #ifdef FEAT_LISTCMDS if (!(flags & ECMD_ADDBUF)) - #endif { if (!cmdmod.keepalt) curwin->w_alt_fnum = curbuf->b_fnum; --- 3828,3834 ---- *************** *** 3844,3850 **** buf = buflist_findnr(fnum); else { - #ifdef FEAT_LISTCMDS if (flags & ECMD_ADDBUF) { linenr_T tlnum = 1L; --- 3840,3845 ---- *************** *** 3858,3864 **** (void)buflist_new(ffname, sfname, tlnum, BLN_LISTED); goto theend; } - #endif buf = buflist_new(ffname, sfname, 0L, BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED)); --- 3853,3858 ---- *************** *** 4016,4026 **** } else /* !other_file */ { ! if ( ! #ifdef FEAT_LISTCMDS ! (flags & ECMD_ADDBUF) || ! #endif ! check_fname() == FAIL) goto theend; oldbuf = (flags & ECMD_OLDBUF); --- 4010,4016 ---- } else /* !other_file */ { ! if ((flags & ECMD_ADDBUF) || check_fname() == FAIL) goto theend; oldbuf = (flags & ECMD_OLDBUF); *** ../vim-8.0.1649/src/ex_cmds2.c 2018-03-29 15:55:30.866510235 +0200 --- src/ex_cmds2.c 2018-03-29 15:56:52.246105819 +0200 *************** *** 2440,2448 **** static int do_arglist(char_u *str, int what, int after); static void alist_check_arg_idx(void); static int editing_arg_idx(win_T *win); - #ifdef FEAT_LISTCMDS static int alist_add_list(int count, char_u **files, int after); - #endif #define AL_SET 1 #define AL_ADD 2 #define AL_DEL 3 --- 2440,2446 ---- *************** *** 2567,2576 **** int exp_count; char_u **exp_files; int i; - #ifdef FEAT_LISTCMDS char_u *p; int match; - #endif int arg_escaped = TRUE; /* --- 2565,2572 ---- *************** *** 2590,2596 **** if (get_arglist(&new_ga, str, arg_escaped) == FAIL) return FAIL; - #ifdef FEAT_LISTCMDS if (what == AL_DEL) { regmatch_T regmatch; --- 2586,2591 ---- *************** *** 2637,2643 **** ga_clear(&new_ga); } else - #endif { i = expand_wildcards(new_ga.ga_len, (char_u **)new_ga.ga_data, &exp_count, &exp_files, EW_DIR|EW_FILE|EW_ADDSLASH|EW_NOTFOUND); --- 2632,2637 ---- *************** *** 2648,2661 **** return FAIL; } - #ifdef FEAT_LISTCMDS if (what == AL_ADD) { (void)alist_add_list(exp_count, exp_files, after); vim_free(exp_files); } else /* what == AL_SET */ - #endif alist_set(ALIST(curwin), exp_count, exp_files, FALSE, NULL, 0); } --- 2642,2653 ---- *************** *** 2737,2752 **** if (eap->cmdidx != CMD_args) { - #if defined(FEAT_LISTCMDS) alist_unlink(ALIST(curwin)); if (eap->cmdidx == CMD_argglobal) ALIST(curwin) = &global_alist; else /* eap->cmdidx == CMD_arglocal */ alist_new(); - #else - ex_ni(eap); - return; - #endif } if (!ends_excmd(*eap->arg)) --- 2729,2739 ---- *************** *** 2757,2766 **** */ ex_next(eap); } ! else ! #if defined(FEAT_LISTCMDS) ! if (eap->cmdidx == CMD_args) ! #endif { /* * ":args": list arguments. --- 2744,2750 ---- */ ex_next(eap); } ! else if (eap->cmdidx == CMD_args) { /* * ":args": list arguments. *************** *** 2781,2787 **** } } } - #if defined(FEAT_LISTCMDS) else if (eap->cmdidx == CMD_arglocal) { garray_T *gap = &curwin->w_alist->al_ga; --- 2765,2770 ---- *************** *** 2800,2806 **** ++gap->ga_len; } } - #endif } /* --- 2783,2788 ---- *************** *** 2951,2957 **** } } - #if defined(FEAT_LISTCMDS) || defined(PROTO) /* * ":argedit" */ --- 2933,2938 ---- *************** *** 3312,3319 **** return -1; } - #endif /* FEAT_LISTCMDS */ - #if defined(FEAT_CMDL_COMPL) || defined(PROTO) /* * Function given to ExpandGeneric() to obtain the possible arguments of the --- 3293,3298 ---- *************** *** 3329,3334 **** --- 3308,3314 ---- } #endif + #ifdef FEAT_EVAL /* * ":compiler[!] {name}" *************** *** 5194,5200 **** } #endif - #if defined(FEAT_LISTCMDS) || defined(PROTO) /* * ":checktime [buffer]" */ --- 5174,5179 ---- *************** *** 5215,5221 **** } no_check_timestamps = save_no_check_timestamps; } - #endif #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ && (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG)) --- 5194,5199 ---- *** ../vim-8.0.1649/src/ex_docmd.c 2018-03-29 15:55:30.866510235 +0200 --- src/ex_docmd.c 2018-03-29 15:57:11.486010079 +0200 *************** *** 83,89 **** #endif static void ex_autocmd(exarg_T *eap); static void ex_doautocmd(exarg_T *eap); - #ifdef FEAT_LISTCMDS static void ex_bunload(exarg_T *eap); static void ex_buffer(exarg_T *eap); static void ex_bmodified(exarg_T *eap); --- 83,88 ---- *************** *** 91,110 **** static void ex_bprevious(exarg_T *eap); static void ex_brewind(exarg_T *eap); static void ex_blast(exarg_T *eap); - #else - # define ex_bunload ex_ni - # define ex_buffer ex_ni - # define ex_bmodified ex_ni - # define ex_bnext ex_ni - # define ex_bprevious ex_ni - # define ex_brewind ex_ni - # define ex_blast ex_ni - # define buflist_list ex_ni - # define ex_checktime ex_ni - #endif - #if !defined(FEAT_LISTCMDS) - # define ex_buffer_all ex_ni - #endif static char_u *getargcmd(char_u **); static char_u *skip_cmd_arg(char_u *p, int rembs); static int getargopt(exarg_T *eap); --- 90,95 ---- *************** *** 184,195 **** static void ex_shell(exarg_T *eap); static void ex_preserve(exarg_T *eap); static void ex_recover(exarg_T *eap); - #ifndef FEAT_LISTCMDS - # define ex_argedit ex_ni - # define ex_argadd ex_ni - # define ex_argdelete ex_ni - # define ex_listdo ex_ni - #endif static void ex_mode(exarg_T *eap); static void ex_wrongmodifier(exarg_T *eap); static void ex_find(exarg_T *eap); --- 169,174 ---- *************** *** 2838,2844 **** goto doend; } - #ifdef FEAT_LISTCMDS /* * Accept buffer name. Cannot be used at the same time with a buffer * number. Don't do this for a user command. --- 2817,2822 ---- *************** *** 2867,2873 **** ea.addr_count = 1; ea.arg = skipwhite(p); } - #endif /* The :try command saves the emsg_silent flag, reset it here when * ":silent! try" was used, it should only apply to :try itself. */ --- 2845,2850 ---- *************** *** 4108,4114 **** set_context_in_sign_cmd(xp, arg); break; #endif - #ifdef FEAT_LISTCMDS case CMD_bdelete: case CMD_bwipeout: case CMD_bunload: --- 4085,4090 ---- *************** *** 4121,4127 **** xp->xp_context = EXPAND_BUFFERS; xp->xp_pattern = arg; break; - #endif #ifdef FEAT_USR_CMDS case CMD_USER: case CMD_USER_BUF: --- 4097,4102 ---- *************** *** 5528,5534 **** do_modelines(0); } - #ifdef FEAT_LISTCMDS /* * :[N]bunload[!] [N] [bufname] unload buffer * :[N]bdelete[!] [N] [bufname] delete buffer from buffer list --- 5503,5508 ---- *************** *** 5627,5633 **** if (eap->do_ecmd_cmd != NULL) do_cmdline_cmd(eap->do_ecmd_cmd); } - #endif int ends_excmd(int c) --- 5601,5606 ---- *************** *** 7988,7994 **** } } - #if defined(FEAT_LISTCMDS) || defined(HAVE_DROP_FILE) || defined(PROTO) /* * Create a new argument list and use it for the current window. */ --- 7961,7966 ---- *************** *** 8008,8014 **** alist_init(curwin->w_alist); } } - #endif #if !defined(UNIX) || defined(PROTO) /* --- 7980,7985 ---- *************** *** 8680,8688 **** + (eap->forceit ? ECMD_FORCEIT : 0) /* after a split we can use an existing buffer */ + (old_curwin != NULL ? ECMD_OLDBUF : 0) - #ifdef FEAT_LISTCMDS + (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 ) - #endif , old_curwin == NULL ? curwin : NULL) == FAIL) { /* Editing the file failed. If the window was split, close it. */ --- 8651,8657 ---- *** ../vim-8.0.1649/src/version.c 2018-03-29 15:55:30.874510195 +0200 --- src/version.c 2018-03-29 16:00:10.317118242 +0200 *************** *** 332,342 **** #else "-lispindent", #endif - #ifdef FEAT_LISTCMDS "+listcmds", - #else - "-listcmds", - #endif #ifdef FEAT_LOCALMAP "+localmap", #else --- 332,338 ---- *** ../vim-8.0.1649/src/feature.h 2018-03-06 18:19:58.984041839 +0100 --- src/feature.h 2018-03-29 15:32:30.428929281 +0200 *************** *** 101,115 **** */ /* - * +listcmds Vim commands for the buffer list and the argument - * list. Without this there is no ":buffer" ":bnext", - * ":bdel", ":argdelete", etc. - */ - #ifdef FEAT_NORMAL - # define FEAT_LISTCMDS - #endif - - /* * +cmdhist Command line history. */ #ifdef FEAT_SMALL --- 101,106 ---- *************** *** 1252,1261 **** #endif /* ! * The Netbeans feature requires +listcmds and +eval. */ ! #if (!defined(FEAT_LISTCMDS) || !defined(FEAT_EVAL)) \ ! && defined(FEAT_NETBEANS_INTG) # undef FEAT_NETBEANS_INTG #endif --- 1243,1251 ---- #endif /* ! * The Netbeans feature requires +eval. */ ! #if !defined(FEAT_EVAL) && defined(FEAT_NETBEANS_INTG) # undef FEAT_NETBEANS_INTG #endif *** ../vim-8.0.1649/src/version.c 2018-03-29 15:55:30.874510195 +0200 --- src/version.c 2018-03-29 16:00:10.317118242 +0200 *************** *** 768,769 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1650, /**/ -- From "know your smileys": :----} You lie like Pinocchio /// 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 ///