summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-29 16:04:08 +0200
committerBram Moolenaar <Bram@vim.org>2018-03-29 16:04:08 +0200
commit0c72fe4ed8430db41f43c5878e6ee60265dc49e9 (patch)
tree1ed985dcd639fe0d976103599009ff835cd7043a
parentcd43effecab02c6c28b1c4a3a14f91b8c3f26c0d (diff)
downloadvim-git-0c72fe4ed8430db41f43c5878e6ee60265dc49e9.tar.gz
patch 8.0.1650: too many #ifdefsv8.0.1650
Problem: Too many #ifdefs. Solution: Graduate FEAT_LISTCMDS, no reason to leave out buffer commands.
-rw-r--r--runtime/doc/various.txt4
-rw-r--r--src/buffer.c45
-rw-r--r--src/charset.c2
-rw-r--r--src/evalfunc.c2
-rw-r--r--src/ex_cmds.c12
-rw-r--r--src/ex_cmds2.c26
-rw-r--r--src/ex_docmd.c31
-rw-r--r--src/feature.h14
-rw-r--r--src/version.c6
9 files changed, 19 insertions, 123 deletions
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index aa355665a..a044d45a0 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -1,4 +1,4 @@
-*various.txt* For Vim version 8.0. Last change: 2018 Mar 10
+*various.txt* For Vim version 8.0. Last change: 2018 Mar 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -384,7 +384,7 @@ 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|
+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
diff --git a/src/buffer.c b/src/buffer.c
index 7bd3cdf01..4b79840cb 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -27,13 +27,9 @@
#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);
@@ -948,7 +944,6 @@ clear_wininfo(buf_T *buf)
}
}
-#if defined(FEAT_LISTCMDS) || defined(FEAT_TERMINAL) || defined(PROTO)
/*
* Go to another buffer. Handles the result of the ATTENTION dialog.
*/
@@ -959,42 +954,41 @@ goto_buffer(
int dir,
int count)
{
-# if defined(HAS_SWAP_EXISTS_ACTION)
+#if defined(HAS_SWAP_EXISTS_ACTION)
bufref_T old_curbuf;
set_bufref(&old_curbuf, curbuf);
swap_exists_action = SEA_DIALOG;
-# endif
+#endif
(void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO,
start, dir, count, eap->forceit);
-# if defined(HAS_SWAP_EXISTS_ACTION)
+#if defined(HAS_SWAP_EXISTS_ACTION)
if (swap_exists_action == SEA_QUIT && *eap->cmd == 's')
{
-# if defined(FEAT_EVAL)
+# 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
+# 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)
+# 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
+# endif
}
else
handle_swap_exists(&old_curbuf);
-# endif
-}
#endif
+}
#if defined(HAS_SWAP_EXISTS_ACTION) || defined(PROTO)
/*
@@ -1072,7 +1066,6 @@ handle_swap_exists(bufref_T *old_curbuf)
}
#endif
-#if defined(FEAT_LISTCMDS) || defined(PROTO)
/*
* do_bufdel() - delete or unload buffer(s)
*
@@ -1199,10 +1192,6 @@ do_bufdel(
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);
@@ -1359,7 +1348,6 @@ do_buffer(
need_mouse_correct = TRUE;
#endif
-#ifdef FEAT_LISTCMDS
/*
* delete buffer buf from memory and/or the list
*/
@@ -1377,7 +1365,7 @@ do_buffer(
if (!forceit && bufIsChanged(buf))
{
-# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
+#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
if ((p_confirm || cmdmod.confirm) && p_write)
{
dialog_changed(buf, FALSE);
@@ -1391,7 +1379,7 @@ do_buffer(
return FAIL;
}
else
-# endif
+#endif
{
EMSGN(_("E89: No write since last change for buffer %ld (add ! to override)"),
buf->b_fnum);
@@ -1557,7 +1545,6 @@ do_buffer(
if (win_split(0, 0) == FAIL)
return FAIL;
}
-#endif
/* go to current buffer - nothing to do */
if (buf == curbuf)
@@ -1590,12 +1577,10 @@ do_buffer(
/* 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 */
@@ -1604,7 +1589,6 @@ do_buffer(
return OK;
}
-#endif
/*
* Set current buffer to "buf". Executes autocommands and closes current
@@ -2411,8 +2395,6 @@ buflist_findname_stat(
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.
@@ -2534,7 +2516,6 @@ buflist_findpat(
EMSG2(_("E94: No matching buffer for %s"), pattern);
return match;
}
-#endif
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
@@ -2644,7 +2625,6 @@ ExpandBufnames(
#endif /* FEAT_CMDL_COMPL */
-#ifdef HAVE_BUFLIST_MATCH
/*
* Check for a match on the file name for buffer "buf" with regprog "prog".
*/
@@ -2695,7 +2675,6 @@ fname_match(
return match;
}
-#endif
/*
* Find a file in the buffer list by buffer number.
@@ -2940,7 +2919,6 @@ buflist_findlnum(buf_T *buf)
return buflist_findfpos(buf)->lnum;
}
-#if defined(FEAT_LISTCMDS) || defined(PROTO)
/*
* List all known file names (for :files and :buffers command).
*/
@@ -3024,7 +3002,6 @@ buflist_list(exarg_T *eap)
ui_breakcheck();
}
}
-#endif
/*
* Get file name and line number for file 'fnum'.
@@ -5095,7 +5072,6 @@ do_arg_all(
vim_free(opened);
}
-# if defined(FEAT_LISTCMDS) || defined(PROTO)
/*
* Open a window for a number of buffers.
*/
@@ -5300,7 +5276,6 @@ ex_buffer_all(exarg_T *eap)
}
}
}
-# endif /* FEAT_LISTCMDS */
static int chk_modeline(linenr_T, int);
diff --git a/src/charset.c b/src/charset.c
index 003949f0a..7da18bb2e 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1787,7 +1787,6 @@ skiptowhite(char_u *p)
return p;
}
-#if defined(FEAT_LISTCMDS) || defined(FEAT_SIGNS) || defined(PROTO)
/*
* skiptowhite_esc: Like skiptowhite(), but also skip escaped chars
*/
@@ -1802,7 +1801,6 @@ skiptowhite_esc(char_u *p)
}
return p;
}
-#endif
/*
* Getdigits: Get a number from a string and skip over it.
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 780458af9..dc2c14c3d 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -5980,9 +5980,7 @@ f_has(typval_T *argvars, typval_T *rettv)
#ifdef FEAT_LISP
"lispindent",
#endif
-#ifdef FEAT_LISTCMDS
"listcmds",
-#endif
#ifdef FEAT_LOCALMAP
"localmap",
#endif
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 6845be57d..e13d34cc0 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3745,10 +3745,8 @@ do_ecmd(
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;
@@ -3830,9 +3828,7 @@ do_ecmd(
*/
if (other_file)
{
-#ifdef FEAT_LISTCMDS
if (!(flags & ECMD_ADDBUF))
-#endif
{
if (!cmdmod.keepalt)
curwin->w_alt_fnum = curbuf->b_fnum;
@@ -3844,7 +3840,6 @@ do_ecmd(
buf = buflist_findnr(fnum);
else
{
-#ifdef FEAT_LISTCMDS
if (flags & ECMD_ADDBUF)
{
linenr_T tlnum = 1L;
@@ -3858,7 +3853,6 @@ do_ecmd(
(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));
@@ -4016,11 +4010,7 @@ do_ecmd(
}
else /* !other_file */
{
- if (
-#ifdef FEAT_LISTCMDS
- (flags & ECMD_ADDBUF) ||
-#endif
- check_fname() == FAIL)
+ if ((flags & ECMD_ADDBUF) || check_fname() == FAIL)
goto theend;
oldbuf = (flags & ECMD_OLDBUF);
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index d4ddb82b7..83f09661c 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2440,9 +2440,7 @@ static char_u *do_one_arg(char_u *str);
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
@@ -2567,10 +2565,8 @@ do_arglist(
int exp_count;
char_u **exp_files;
int i;
-#ifdef FEAT_LISTCMDS
char_u *p;
int match;
-#endif
int arg_escaped = TRUE;
/*
@@ -2590,7 +2586,6 @@ do_arglist(
if (get_arglist(&new_ga, str, arg_escaped) == FAIL)
return FAIL;
-#ifdef FEAT_LISTCMDS
if (what == AL_DEL)
{
regmatch_T regmatch;
@@ -2637,7 +2632,6 @@ do_arglist(
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);
@@ -2648,14 +2642,12 @@ do_arglist(
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);
}
@@ -2737,16 +2729,11 @@ ex_args(exarg_T *eap)
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))
@@ -2757,10 +2744,7 @@ ex_args(exarg_T *eap)
*/
ex_next(eap);
}
- else
-#if defined(FEAT_LISTCMDS)
- if (eap->cmdidx == CMD_args)
-#endif
+ else if (eap->cmdidx == CMD_args)
{
/*
* ":args": list arguments.
@@ -2781,7 +2765,6 @@ ex_args(exarg_T *eap)
}
}
}
-#if defined(FEAT_LISTCMDS)
else if (eap->cmdidx == CMD_arglocal)
{
garray_T *gap = &curwin->w_alist->al_ga;
@@ -2800,7 +2783,6 @@ ex_args(exarg_T *eap)
++gap->ga_len;
}
}
-#endif
}
/*
@@ -2951,7 +2933,6 @@ ex_next(exarg_T *eap)
}
}
-#if defined(FEAT_LISTCMDS) || defined(PROTO)
/*
* ":argedit"
*/
@@ -3312,8 +3293,6 @@ alist_add_list(
return -1;
}
-#endif /* FEAT_LISTCMDS */
-
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
/*
* Function given to ExpandGeneric() to obtain the possible arguments of the
@@ -3329,6 +3308,7 @@ get_arglist_name(expand_T *xp UNUSED, int idx)
}
#endif
+
#ifdef FEAT_EVAL
/*
* ":compiler[!] {name}"
@@ -5194,7 +5174,6 @@ source_finished(
}
#endif
-#if defined(FEAT_LISTCMDS) || defined(PROTO)
/*
* ":checktime [buffer]"
*/
@@ -5215,7 +5194,6 @@ ex_checktime(exarg_T *eap)
}
no_check_timestamps = save_no_check_timestamps;
}
-#endif
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
&& (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG))
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index c2d69670b..3a6c7cfb1 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -83,7 +83,6 @@ static void ex_abclear(exarg_T *eap);
#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);
@@ -91,20 +90,6 @@ static void ex_bnext(exarg_T *eap);
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);
@@ -184,12 +169,6 @@ static void ex_goto(exarg_T *eap);
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);
@@ -2838,7 +2817,6 @@ do_one_cmd(
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.
@@ -2867,7 +2845,6 @@ do_one_cmd(
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. */
@@ -4108,7 +4085,6 @@ set_one_cmd_context(
set_context_in_sign_cmd(xp, arg);
break;
#endif
-#ifdef FEAT_LISTCMDS
case CMD_bdelete:
case CMD_bwipeout:
case CMD_bunload:
@@ -4121,7 +4097,6 @@ set_one_cmd_context(
xp->xp_context = EXPAND_BUFFERS;
xp->xp_pattern = arg;
break;
-#endif
#ifdef FEAT_USR_CMDS
case CMD_USER:
case CMD_USER_BUF:
@@ -5528,7 +5503,6 @@ ex_doautocmd(exarg_T *eap)
do_modelines(0);
}
-#ifdef FEAT_LISTCMDS
/*
* :[N]bunload[!] [N] [bufname] unload buffer
* :[N]bdelete[!] [N] [bufname] delete buffer from buffer list
@@ -5627,7 +5601,6 @@ ex_blast(exarg_T *eap)
if (eap->do_ecmd_cmd != NULL)
do_cmdline_cmd(eap->do_ecmd_cmd);
}
-#endif
int
ends_excmd(int c)
@@ -7988,7 +7961,6 @@ alist_unlink(alist_T *al)
}
}
-#if defined(FEAT_LISTCMDS) || defined(HAVE_DROP_FILE) || defined(PROTO)
/*
* Create a new argument list and use it for the current window.
*/
@@ -8008,7 +7980,6 @@ alist_new(void)
alist_init(curwin->w_alist);
}
}
-#endif
#if !defined(UNIX) || defined(PROTO)
/*
@@ -8680,9 +8651,7 @@ do_exedit(
+ (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. */
diff --git a/src/feature.h b/src/feature.h
index 9754d0bc6..5b915b838 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -101,15 +101,6 @@
*/
/*
- * +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
@@ -1252,10 +1243,9 @@
#endif
/*
- * The Netbeans feature requires +listcmds and +eval.
+ * The Netbeans feature requires +eval.
*/
-#if (!defined(FEAT_LISTCMDS) || !defined(FEAT_EVAL)) \
- && defined(FEAT_NETBEANS_INTG)
+#if !defined(FEAT_EVAL) && defined(FEAT_NETBEANS_INTG)
# undef FEAT_NETBEANS_INTG
#endif
diff --git a/src/version.c b/src/version.c
index 1e277129c..ae154b4e1 100644
--- a/src/version.c
+++ b/src/version.c
@@ -332,11 +332,7 @@ static char *(features[]) =
#else
"-lispindent",
#endif
-#ifdef FEAT_LISTCMDS
"+listcmds",
-#else
- "-listcmds",
-#endif
#ifdef FEAT_LOCALMAP
"+localmap",
#else
@@ -767,6 +763,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1650,
+/**/
1649,
/**/
1648,