mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.0.1650: too many #ifdefs
Problem: Too many #ifdefs. Solution: Graduate FEAT_LISTCMDS, no reason to leave out buffer commands.
This commit is contained in:
45
src/buffer.c
45
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);
|
||||
|
Reference in New Issue
Block a user