aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/buffer.c10
-rw-r--r--src/nvim/ex_cmds.c4
-rw-r--r--src/nvim/fileio.c2
-rw-r--r--src/nvim/globals.h1
-rw-r--r--src/nvim/main.c18
-rw-r--r--src/nvim/memline.c4
6 files changed, 0 insertions, 39 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 6880d2c428..3a378ea360 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -602,7 +602,6 @@ void goto_buffer(exarg_T *eap, int start, int dir, int count)
{
(void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO,
start, dir, count, eap->forceit);
-#ifdef HAS_SWAP_EXISTS_ACTION
buf_T *old_curbuf = curbuf;
swap_exists_action = SEA_DIALOG;
@@ -624,10 +623,8 @@ void goto_buffer(exarg_T *eap, int start, int dir, int count)
} else {
handle_swap_exists(old_curbuf);
}
-#endif
}
-#if defined(HAS_SWAP_EXISTS_ACTION)
/*
* Handle the situation of swap_exists_action being set.
* It is allowed for "old_curbuf" to be NULL or invalid.
@@ -678,7 +675,6 @@ void handle_swap_exists(buf_T *old_curbuf)
}
swap_exists_action = SEA_NONE;
}
-#endif
/*
* do_bufdel() - delete or unload buffer(s)
@@ -3934,17 +3930,12 @@ void ex_buffer_all(exarg_T *eap)
continue;
/* Open the buffer in this window. */
-#if defined(HAS_SWAP_EXISTS_ACTION)
swap_exists_action = SEA_DIALOG;
-#endif
set_curbuf(buf, DOBUF_GOTO);
if (!buf_valid(buf)) { /* 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) {
cleanup_T cs;
@@ -3964,7 +3955,6 @@ void ex_buffer_all(exarg_T *eap)
leave_cleanup(&cs);
} else
handle_swap_exists(NULL);
-#endif
}
os_breakcheck();
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 2094975602..763a2d6212 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -2978,9 +2978,7 @@ do_ecmd (
lnum = curwin->w_cursor.lnum;
topline = curwin->w_topline;
if (!oldbuf) { /* need to read the file */
-#if defined(HAS_SWAP_EXISTS_ACTION)
swap_exists_action = SEA_DIALOG;
-#endif
curbuf->b_flags |= BF_CHECK_RO; /* set/reset 'ro' flag */
/*
@@ -2989,11 +2987,9 @@ do_ecmd (
if (should_abort(open_buffer(FALSE, eap, readfile_flags)))
retval = FAIL;
-#if defined(HAS_SWAP_EXISTS_ACTION)
if (swap_exists_action == SEA_QUIT)
retval = FAIL;
handle_swap_exists(old_curbuf);
-#endif
} else {
/* Read the modelines, but only to set window-local options. Any
* buffer-local options have already been set and may have been
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 76f7779eb0..370584b095 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -636,14 +636,12 @@ readfile (
#endif
}
-#if defined(HAS_SWAP_EXISTS_ACTION)
/* If "Quit" selected at ATTENTION dialog, don't load the file */
if (swap_exists_action == SEA_QUIT) {
if (!read_buffer && !read_stdin)
close(fd);
return FAIL;
}
-#endif
++no_wait_return; /* don't wait for return yet */
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 11a7e9ecac..73bcdea226 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -859,7 +859,6 @@ EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */
#define SEA_QUIT 2 /* quit editing the file */
#define SEA_RECOVER 3 /* recover the file */
-#define HAS_SWAP_EXISTS_ACTION
EXTERN int swap_exists_action INIT(= SEA_NONE);
/* For dialog when swap file already
* exists. */
diff --git a/src/nvim/main.c b/src/nvim/main.c
index f063cc1238..93a938f291 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1560,19 +1560,15 @@ static void handle_quickfix(mparm_T *paramp)
static void handle_tag(char_u *tagname)
{
if (tagname != NULL) {
-#if defined(HAS_SWAP_EXISTS_ACTION)
swap_exists_did_quit = FALSE;
-#endif
vim_snprintf((char *)IObuff, IOSIZE, "ta %s", tagname);
do_cmdline_cmd(IObuff);
TIME_MSG("jumping to tag");
-#if defined(HAS_SWAP_EXISTS_ACTION)
/* If the user doesn't want to edit the file then we quit here. */
if (swap_exists_did_quit)
getout(1);
-#endif
}
}
@@ -1607,10 +1603,8 @@ static void read_stdin(void)
{
int i;
-#if defined(HAS_SWAP_EXISTS_ACTION)
/* When getting the ATTENTION prompt here, use a dialog */
swap_exists_action = SEA_DIALOG;
-#endif
no_wait_return = TRUE;
i = msg_didany;
set_buflisted(TRUE);
@@ -1618,9 +1612,7 @@ static void read_stdin(void)
no_wait_return = FALSE;
msg_didany = i;
TIME_MSG("reading stdin");
-#if defined(HAS_SWAP_EXISTS_ACTION)
check_swap_exists_action();
-#endif
/*
* Close stdin and dup it from stderr. Required for GPM to work
* properly, and for running external commands.
@@ -1702,16 +1694,13 @@ static void create_windows(mparm_T *parmp)
/* Set 'foldlevel' to 'foldlevelstart' if it's not negative. */
if (p_fdls >= 0)
curwin->w_p_fdl = p_fdls;
-#if defined(HAS_SWAP_EXISTS_ACTION)
/* When getting the ATTENTION prompt here, use a dialog */
swap_exists_action = SEA_DIALOG;
-#endif
set_buflisted(TRUE);
/* create memfile, read file */
(void)open_buffer(FALSE, NULL, 0);
-#if defined(HAS_SWAP_EXISTS_ACTION)
if (swap_exists_action == SEA_QUIT) {
if (got_int || only_one_window()) {
/* abort selected or quit and only one window */
@@ -1726,7 +1715,6 @@ static void create_windows(mparm_T *parmp)
swap_exists_action = SEA_NONE;
} else
handle_swap_exists(NULL);
-#endif
dorewind = TRUE; /* start again */
}
os_breakcheck();
@@ -1797,13 +1785,10 @@ static void edit_buffers(mparm_T *parmp)
curwin->w_arg_idx = arg_idx;
/* Edit file from arg list, if there is one. When "Quit" selected
* at the ATTENTION prompt close the window. */
-# ifdef HAS_SWAP_EXISTS_ACTION
swap_exists_did_quit = FALSE;
-# endif
(void)do_ecmd(0, arg_idx < GARGCOUNT
? alist_name(&GARGLIST[arg_idx]) : NULL,
NULL, NULL, ECMD_LASTL, ECMD_HIDE, curwin);
-# ifdef HAS_SWAP_EXISTS_ACTION
if (swap_exists_did_quit) {
/* abort or quit selected */
if (got_int || only_one_window()) {
@@ -1814,7 +1799,6 @@ static void edit_buffers(mparm_T *parmp)
win_close(curwin, TRUE);
advance = FALSE;
}
-# endif
if (arg_idx == GARGCOUNT - 1)
arg_had_last = TRUE;
++arg_idx;
@@ -2215,7 +2199,6 @@ static void usage(void)
mch_exit(0);
}
-#if defined(HAS_SWAP_EXISTS_ACTION)
/*
* Check the result of the ATTENTION dialog:
* When "Quit" selected, exit Vim.
@@ -2228,5 +2211,4 @@ static void check_swap_exists_action(void)
handle_swap_exists(NULL);
}
-#endif
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 930127b3ea..1fa6d6acc6 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -3367,9 +3367,7 @@ findswapname (
* for the current file, and the buffer was not recovered. */
if (differ == FALSE && !(curbuf->b_flags & BF_RECOVERED)
&& vim_strchr(p_shm, SHM_ATTENTION) == NULL) {
-#if defined(HAS_SWAP_EXISTS_ACTION)
int choice = 0;
-#endif
#ifdef UNIX
process_still_running = FALSE;
@@ -3427,7 +3425,6 @@ findswapname (
redraw_all_later(NOT_VALID);
}
-#if defined(HAS_SWAP_EXISTS_ACTION)
if (choice > 0) {
switch (choice) {
case 1:
@@ -3454,7 +3451,6 @@ findswapname (
if (!os_file_exists(fname))
break;
} else
-#endif
{
MSG_PUTS("\n");
if (msg_silent == 0)