Permalink
Browse files

patch 8.0.1650: too many #ifdefs

Problem:    Too many #ifdefs.
Solution:   Graduate FEAT_LISTCMDS, no reason to leave out buffer commands.
  • Loading branch information...
brammool committed Mar 29, 2018
1 parent cd43eff commit 0c72fe4ed8430db41f43c5878e6ee60265dc49e9
Showing with 19 additions and 123 deletions.
  1. +2 −2 runtime/doc/various.txt
  2. +10 −35 src/buffer.c
  3. +0 −2 src/charset.c
  4. +0 −2 src/evalfunc.c
  5. +1 −11 src/ex_cmds.c
  6. +2 −24 src/ex_cmds2.c
  7. +0 −31 src/ex_docmd.c
  8. +2 −12 src/feature.h
  9. +2 −4 src/version.c
@@ -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
@@ -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);
@@ -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.
@@ -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
@@ -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);
Oops, something went wrong.

0 comments on commit 0c72fe4

Please sign in to comment.