tweaks: transform the token DISABLE_MULTIBUFFER to ENABLE_MULTIBUFFER

master
Benno Schulenberg 2017-05-01 20:20:34 +02:00
parent a9c4682c25
commit 9c3a149b14
6 changed files with 44 additions and 40 deletions

View File

@ -166,8 +166,15 @@ fi
AC_ARG_ENABLE(multibuffer,
AS_HELP_STRING([--disable-multibuffer], [Disable multiple file buffers]))
if test "x$enable_multibuffer" = xno; then
AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.])
if test "x$enable_tiny" = xyes; then
if test "x$enable_multibuffer" != xyes; then
enable_multibuffer=no
fi
fi
if test "x$disable_multibuffer" != xyes; then
if test "x$enable_multibuffer" != xno; then
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.])
fi
fi
AC_ARG_ENABLE(nanorc,
@ -261,9 +268,6 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_mouse" != xyes; then
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable mouse support.])
fi
if test "x$enable_multibuffer" != xyes; then
AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.])
fi
if test "x$enable_nanorc" != xyes; then
AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
fi

View File

@ -470,7 +470,7 @@ bool open_buffer(const char *filename, bool undoable)
if (ISSET(LOCKING) && filename[0] != '\0') {
/* When not overriding an existing lock, discard the buffer. */
if (do_lockfile(realname) < 0) {
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
close_buffer();
#endif
free(realname);
@ -600,7 +600,7 @@ void prepare_for_display(void)
refresh_needed = TRUE;
}
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
/* Switch to a neighbouring file buffer; to the next if to_next is TRUE;
* otherwise, to the previous one. */
void switch_to_prevnext_buffer(bool to_next)
@ -683,7 +683,7 @@ bool close_buffer(void)
return TRUE;
}
#endif /* !DISABLE_MULTIBUFFER */
#endif /* ENABLE_MULTIBUFFER */
/* Do a quick permissions check by verifying whether the file is appendable.
* Err on the side of permissiveness (reporting TRUE when it might be wrong)
@ -1064,7 +1064,7 @@ void do_insertfile(void)
while (TRUE) {
#ifndef NANO_TINY
if (execute) {
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER))
/* TRANSLATORS: The next four messages are prompts. */
msg = _("Command to execute in new buffer");
@ -1074,7 +1074,7 @@ void do_insertfile(void)
} else
#endif /* NANO_TINY */
{
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER))
msg = _("File to insert into new buffer [from %s]");
else
@ -1112,7 +1112,7 @@ void do_insertfile(void)
given = mallocstrcpy(given, answer);
#ifndef NANO_TINY
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
if (func == new_buffer_void) {
/* Don't allow toggling when in view mode. */
if (!ISSET(VIEW_MODE))
@ -1147,7 +1147,7 @@ void do_insertfile(void)
#ifndef NANO_TINY
if (execute) {
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
/* When in multibuffer mode, first open a blank buffer. */
if (ISSET(MULTIBUFFER))
open_buffer("", FALSE);
@ -1155,7 +1155,7 @@ void do_insertfile(void)
/* Save the command's output in the current buffer. */
execute_command(answer);
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
/* If this is a new buffer, put the cursor at the top. */
if (ISSET(MULTIBUFFER)) {
openfile->current = openfile->fileage;
@ -1176,7 +1176,7 @@ void do_insertfile(void)
open_buffer(answer, TRUE);
}
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER)) {
#ifndef DISABLE_HISTORIES
if (ISSET(POS_HISTORY)) {
@ -1191,7 +1191,7 @@ void do_insertfile(void)
/* Update stuff to account for the current buffer. */
prepare_for_display();
} else
#endif /* !DISABLE_MULTIBUFFER */
#endif /* ENABLE_MULTIBUFFER */
{
/* Mark the file as modified if it changed. */
if (openfile->current->lineno != was_current_lineno ||
@ -1216,7 +1216,7 @@ void do_insertfile_void(void)
{
if (ISSET(RESTRICTED))
show_restricted_warning();
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
else if (ISSET(VIEW_MODE) && !ISSET(MULTIBUFFER))
statusbar(_("Key invalid in non-multibuffer mode"));
#endif

View File

@ -494,7 +494,7 @@ void shortcut_init(void)
const char *nano_cancel_msg = N_("Cancel the current function");
const char *nano_help_msg = N_("Display this help text");
const char *nano_exit_msg =
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
N_("Close the current file buffer / Exit from nano")
#else
N_("Exit from nano")
@ -563,7 +563,7 @@ void shortcut_init(void)
const char *nano_scrolldown_msg =
N_("Scroll down one line without scrolling the cursor");
#endif
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
const char *nano_prevfile_msg = N_("Switch to the previous file buffer");
const char *nano_nextfile_msg = N_("Switch to the next file buffer");
#endif
@ -626,7 +626,7 @@ void shortcut_init(void)
const char *nano_prepend_msg = N_("Toggle prepending");
const char *nano_backup_msg = N_("Toggle backing up of the original file");
const char *nano_execute_msg = N_("Execute external command");
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
const char *nano_newbuffer_msg = N_("Toggle the use of a new buffer");
#endif
#endif
@ -688,7 +688,7 @@ void shortcut_init(void)
read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER,
/* We allow inserting files in view mode if multibuffer mode
* is switched on, so that we can view multiple files. */
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
VIEW);
#else
NOVIEW);
@ -866,7 +866,7 @@ void shortcut_init(void)
add_to_funcs(do_last_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
N_("Last Line"), IFSCHELP(nano_lastline_msg), BLANKAFTER, VIEW);
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
add_to_funcs(switch_to_prev_buffer_void, MMAIN,
N_("Prev File"), IFSCHELP(nano_prevfile_msg), TOGETHER, VIEW);
add_to_funcs(switch_to_next_buffer_void, MMAIN,
@ -995,7 +995,7 @@ void shortcut_init(void)
add_to_funcs(flip_execute_void, MEXTCMD,
read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW);
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
add_to_funcs(new_buffer_void, MINSERTFILE|MEXTCMD,
N_("New Buffer"), IFSCHELP(nano_newbuffer_msg), TOGETHER, NOVIEW);
#endif
@ -1170,7 +1170,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-+", 0, do_scroll_down, 0);
add_to_sclist(MMAIN, "M-=", 0, do_scroll_down, 0);
#endif
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
add_to_sclist(MMAIN, "M-<", 0, switch_to_prev_buffer_void, 0);
add_to_sclist(MMAIN, "M-,", 0, switch_to_prev_buffer_void, 0);
add_to_sclist(MMAIN, "M->", 0, switch_to_next_buffer_void, 0);
@ -1213,7 +1213,7 @@ void shortcut_init(void)
/* Group of "Peripheral-feature" toggles. */
add_to_sclist(MMAIN, "M-B", 0, do_toggle_void, BACKUP_FILE);
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
add_to_sclist(MMAIN, "M-F", 0, do_toggle_void, MULTIBUFFER);
#endif
#ifndef DISABLE_MOUSE
@ -1541,7 +1541,7 @@ sc *strtosc(const char *input)
s->scfunc = do_first_line;
else if (!strcasecmp(input, "lastline"))
s->scfunc = do_last_line;
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
else if (!strcasecmp(input, "prevbuf"))
s->scfunc = switch_to_prev_buffer_void;
else if (!strcasecmp(input, "nextbuf"))
@ -1593,7 +1593,7 @@ sc *strtosc(const char *input)
else if (!strcasecmp(input, "flipexecute"))
s->scfunc = flip_execute_void;
#endif
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
else if (!strcasecmp(input, "flipnewbuffer") ||
!strcasecmp(input, "newbuffer")) /* Deprecated. Remove in 2018. */
s->scfunc = new_buffer_void;
@ -1642,7 +1642,7 @@ sc *strtosc(const char *input)
s->toggle = TABS_TO_SPACES;
else if (!strcasecmp(input, "backupfile"))
s->toggle = BACKUP_FILE;
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
else if (!strcasecmp(input, "multibuffer"))
s->toggle = MULTIBUFFER;
#endif

View File

@ -606,7 +606,7 @@ void die(const char *msg, ...)
die_save_file(openfile->filename, openfile->current_stat);
}
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
/* Save all of the other modified file buffers, if any. */
if (openfile != NULL) {
openfilestruct *firstone = openfile;
@ -794,7 +794,7 @@ void usage(void)
#ifndef NANO_TINY
print_opt("-E", "--tabstospaces", N_("Convert typed tabs to spaces"));
#endif
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
if (!ISSET(RESTRICTED))
print_opt("-F", "--multibuffer",
N_("Read a file into a new buffer by default"));
@ -949,7 +949,7 @@ void version(void)
#ifndef DISABLE_NANORC
printf(" --enable-nanorc");
#endif
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
printf(" --enable-multibuffer");
#endif
#ifndef DISABLE_OPERATINGDIR
@ -995,7 +995,7 @@ void version(void)
#ifdef DISABLE_MOUSE
printf(" --disable-mouse");
#endif
#ifdef DISABLE_MULTIBUFFER
#ifndef ENABLE_MULTIBUFFER
printf(" --disable-multibuffer");
#endif
#ifdef DISABLE_NANORC
@ -1087,7 +1087,7 @@ void close_and_go(void)
if (ISSET(LOCKING) && openfile->lock_filename)
delete_lockfile(openfile->lock_filename);
#endif
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
/* If there are no more open file buffers, jump off a cliff. */
if (!close_buffer())
#endif
@ -1911,14 +1911,14 @@ int main(int argc, char **argv)
/* Should long lines be automatically hard wrapped? */
#endif
#endif
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
bool old_multibuffer;
/* The old value of the multibuffer option, restored after we
* load all files on the command line. */
#endif
const struct option long_options[] = {
{"boldtext", 0, NULL, 'D'},
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
{"multibuffer", 0, NULL, 'F'},
#endif
#ifndef DISABLE_NANORC
@ -2059,7 +2059,7 @@ int main(int argc, char **argv)
SET(TABS_TO_SPACES);
break;
#endif
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
case 'F':
SET(MULTIBUFFER);
break;
@ -2553,7 +2553,7 @@ int main(int argc, char **argv)
optind++;
}
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
old_multibuffer = ISSET(MULTIBUFFER);
SET(MULTIBUFFER);
@ -2592,7 +2592,7 @@ int main(int argc, char **argv)
}
}
}
#endif /* !DISABLE_MULTIBUFFER */
#endif /* ENABLE_MULTIBUFFER */
/* Now read the first file on the command line into a new buffer. */
if (optind < argc)
@ -2606,7 +2606,7 @@ int main(int argc, char **argv)
UNSET(VIEW_MODE);
}
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
if (!old_multibuffer)
UNSET(MULTIBUFFER);
#endif

View File

@ -268,7 +268,7 @@ void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
#endif
#endif
void prepare_for_display(void);
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
void switch_to_prev_buffer_void(void);
void switch_to_next_buffer_void(void);
bool close_buffer(void);

View File

@ -56,7 +56,7 @@ static const rcoption rcopts[] = {
#ifndef DISABLE_MOUSE
{"mouse", USE_MOUSE},
#endif
#ifndef DISABLE_MULTIBUFFER
#ifdef ENABLE_MULTIBUFFER
{"multibuffer", MULTIBUFFER},
#endif
{"nohelp", NO_HELP},