From 0636d7b79712fff696d59663a2e644f31f32ea03 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 3 Apr 2014 20:23:07 +0000 Subject: [PATCH] Converting #ifdef ENABLE_MULTIBUFFER to #ifndef DISABLE_MULTIBUFFER. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4712 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ configure.ac | 5 +++-- src/files.c | 29 ++++++++++++++--------------- src/global.c | 22 +++++++++++----------- src/nano.c | 22 +++++++++++----------- src/proto.h | 2 +- src/rcfile.c | 2 +- 7 files changed, 43 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3d4ea37..98df72d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * doc/syntax/po.nanorc: New file, syntax colouring for PO files. * configure.ac: Stop --with-slang from duplicating --enable-tiny. * configure.ac: Sort all the disabling options alphabetically. + * src/{proto.h,files.c,global.c,nano.c,rcfile.c}, configure.ac: + Convert #ifdef ENABLE_MULTIBUFFER to #ifndef DISABLE_MULTIBUFFER. 2014-04-02 Benno Schulenberg * configure.ac, doc/Makefile.am: Try to build the info documentation diff --git a/configure.ac b/configure.ac index e3ce7808..2f500d9c 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ if test "x$enable_tiny" = xyes; then AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.]) AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.]) AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.]) + AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.]) AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).]) AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.]) AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab completion functions for files and search strings.]) @@ -136,8 +137,8 @@ fi AC_ARG_ENABLE(multibuffer, AS_HELP_STRING([--disable-multibuffer], [Disable multiple file buffers])) -if test "x$enable_multibuffer" != xno; then - AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) +if test "x$enable_multibuffer" = xno; then + AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.]) fi AC_ARG_ENABLE(nanorc, diff --git a/src/files.c b/src/files.c index a7ac0a90..59cf67b9 100644 --- a/src/files.c +++ b/src/files.c @@ -311,7 +311,7 @@ int do_lockfile(const char *filename) void open_buffer(const char *filename, bool undoable) { bool new_buffer = (openfile == NULL -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER || ISSET(MULTIBUFFER) #endif ); @@ -424,7 +424,7 @@ void display_buffer(void) edit_refresh(); } -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER /* Switch to the next file buffer if next_buf is TRUE. Otherwise, * switch to the previous file buffer. */ void switch_to_prevnext_buffer(bool next_buf) @@ -497,7 +497,7 @@ bool close_buffer(void) return TRUE; } -#endif /* ENABLE_MULTIBUFFER */ +#endif /* !DISABLE_MULTIBUFFER */ /* A bit of a copy and paste from open_file(), is_file_writable() * just checks whether the file is appendable as a quick @@ -1027,7 +1027,7 @@ void do_insertfile( #ifndef NANO_TINY if (execute) { msg = -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER ISSET(MULTIBUFFER) ? _("Command to execute in new buffer [from %s] ") : #endif @@ -1035,7 +1035,7 @@ void do_insertfile( } else { #endif msg = -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER ISSET(MULTIBUFFER) ? _("File to insert into new buffer [from %s] ") : #endif @@ -1068,7 +1068,7 @@ void do_insertfile( * filename or command begins with a newline (i.e. an encoded * null), treat it as though it's blank. */ if (i == -1 || ((i == -2 || *answer == '\n') -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER && !ISSET(MULTIBUFFER) #endif )) { @@ -1082,8 +1082,7 @@ void do_insertfile( s = get_shortcut(currmenu, &i, &meta_key, &func_key); #ifndef NANO_TINY -#ifdef ENABLE_MULTIBUFFER - +#ifndef DISABLE_MULTIBUFFER if (s && s->scfunc == new_buffer_void) { /* Don't allow toggling if we're in view mode. */ if (!ISSET(VIEW_MODE)) @@ -1118,7 +1117,7 @@ void do_insertfile( /* If we don't have a file yet, go back to the statusbar * prompt. */ if (i != 0 -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER && (i != -2 || !ISSET(MULTIBUFFER)) #endif ) @@ -1139,7 +1138,7 @@ void do_insertfile( } #endif -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER if (!ISSET(MULTIBUFFER)) { #endif /* If we're not inserting into a new buffer, partition @@ -1152,7 +1151,7 @@ void do_insertfile( openfile->current_x); edittop_inside = (openfile->edittop == openfile->fileage); -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER } #endif @@ -1163,7 +1162,7 @@ void do_insertfile( #ifndef NANO_TINY if (execute) { -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER if (ISSET(MULTIBUFFER)) /* Open a blank buffer. */ open_buffer("", FALSE); @@ -1172,7 +1171,7 @@ void do_insertfile( /* Save the command's output in the current buffer. */ execute_command(answer); -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER if (ISSET(MULTIBUFFER)) { /* Move back to the beginning of the first line of * the buffer. */ @@ -1195,7 +1194,7 @@ void do_insertfile( } #endif -#if defined(ENABLE_MULTIBUFFER) && defined(ENABLE_NANORC) +#if !defined(DISABLE_MULTIBUFFER) && defined(ENABLE_NANORC) if (ISSET(MULTIBUFFER)) { /* Update the screen to account for the current * buffer. */ @@ -1294,7 +1293,7 @@ void do_insertfile_void(void) return; } -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER if (ISSET(VIEW_MODE) && !ISSET(MULTIBUFFER)) statusbar(_("Key invalid in non-multibuffer mode")); else diff --git a/src/global.c b/src/global.c index 80d0d743..693ab5dd 100644 --- a/src/global.c +++ b/src/global.c @@ -550,7 +550,7 @@ const char *append_msg = N_("Append"); const char *prepend_msg = N_("Prepend"); const char *backup_file_msg = N_("Backup File"); const char *ext_cmd_msg = N_("Execute Command"); -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER const char *new_buffer_msg = N_("New Buffer"); #endif const char *goto_dir_msg = N_("Go To Dir"); @@ -593,7 +593,7 @@ void shortcut_init(bool unjustify) 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 = -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER N_("Close the current file buffer / Exit from nano") #else N_("Exit from nano") @@ -657,7 +657,7 @@ void shortcut_init(bool unjustify) const char *nano_scrolldown_msg = N_("Scroll down one line without scrolling the cursor"); #endif -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER const char *nano_prevfile_msg = N_("Switch to the previous file buffer"); const char *nano_nextfile_msg = @@ -718,7 +718,7 @@ void shortcut_init(bool unjustify) N_("Toggle backing up of the original file"); const char *nano_execute_msg = N_("Execute external command"); #endif -#if !defined(NANO_TINY) && defined(ENABLE_MULTIBUFFER) +#ifndef DISABLE_MULTIBUFFER const char *nano_multibuffer_msg = N_("Toggle the use of a new buffer"); #endif @@ -760,7 +760,7 @@ void shortcut_init(bool unjustify) cancel_msg, IFSCHELP(nano_cancel_msg), FALSE, VIEW); add_to_funcs(do_exit, MMAIN, -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER /* TRANSLATORS: Try to keep this at most 10 characters. */ openfile != NULL && openfile != openfile->next ? N_("Close") : #endif @@ -782,7 +782,7 @@ void shortcut_init(bool unjustify) add_to_funcs(do_insertfile_void, /* TRANSLATORS: Try to keep this at most 10 characters. */ MMAIN, N_("Read File"), IFSCHELP(nano_insert_msg), FALSE, -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER VIEW); #else NOVIEW); @@ -946,7 +946,7 @@ void shortcut_init(bool unjustify) IFSCHELP(nano_scrolldown_msg), FALSE, VIEW); #endif -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER add_to_funcs(switch_to_prev_buffer_void, MMAIN, N_("Previous File"), IFSCHELP(nano_prevfile_msg), FALSE, VIEW); add_to_funcs(switch_to_next_buffer_void, MMAIN, N_("Next File"), @@ -1071,7 +1071,7 @@ void shortcut_init(bool unjustify) add_to_funcs(ext_cmd_void, MINSERTFILE, ext_cmd_msg, IFSCHELP(nano_execute_msg), FALSE, NOVIEW); -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER add_to_funcs(new_buffer_void, MINSERTFILE|MEXTCMD, new_buffer_msg, IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW); #endif @@ -1221,7 +1221,7 @@ void shortcut_init(bool unjustify) add_to_sclist(MMAIN, "M-=", do_scroll_down, 0, TRUE); #endif -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER add_to_sclist(MMAIN, "M-<", switch_to_prev_buffer_void, 0, TRUE); add_to_sclist(MMAIN, "M-,", switch_to_prev_buffer_void, 0, TRUE); add_to_sclist(MMAIN, "M->", switch_to_next_buffer_void, 0, TRUE); @@ -1538,7 +1538,7 @@ sc *strtosc(int menu, char *input) s->scfunc = do_home; else if (!strcasecmp(input, "end")) s->scfunc = do_end; -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER else if (!strcasecmp(input, "prevbuf")) s->scfunc = switch_to_prev_buffer_void; else if (!strcasecmp(input, "nextbuf")) @@ -1588,7 +1588,7 @@ sc *strtosc(int menu, char *input) } else if (!strcasecmp(input, "backup")) { s->scfunc = backup_file_void; s->execute = FALSE; -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER } else if (!strcasecmp(input, "newbuffer")) { s->scfunc = new_buffer_void; s->execute = FALSE; diff --git a/src/nano.c b/src/nano.c index 083779a8..c475f1c6 100644 --- a/src/nano.c +++ b/src/nano.c @@ -657,7 +657,7 @@ void die(const char *msg, ...) ); } -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER /* Save all of the other modified file buffers, if any. */ if (openfile != NULL) { openfilestruct *tmp = openfile; @@ -853,7 +853,7 @@ void usage(void) print_opt("-E", "--tabstospaces", N_("Convert typed tabs to spaces")); #endif -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER print_opt("-F", "--multibuffer", N_("Enable multiple file buffers")); #endif #ifdef ENABLE_NANORC @@ -980,6 +980,9 @@ void version(void) #ifdef DISABLE_MOUSE printf(" --disable-mouse"); #endif +#ifdef DISABLE_MULTIBUFFER + printf(" --disable-multibuffer"); +#endif #ifndef ENABLE_NLS printf(" --disable-nls"); #endif @@ -1007,9 +1010,6 @@ void version(void) #ifdef NANO_EXTRA printf(" --enable-extra"); #endif -#ifdef ENABLE_MULTIBUFFER - printf(" --enable-multibuffer"); -#endif #ifdef ENABLE_NANORC printf(" --enable-nanorc"); #endif @@ -1081,7 +1081,7 @@ void do_exit(void) delete_lockfile(openfile->lock_filename); #endif -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER /* Exit only if there are no more open file buffers. */ if (!close_buffer()) #endif @@ -2054,7 +2054,7 @@ int main(int argc, char **argv) bool fill_used = FALSE; /* Was the fill option used? */ #endif -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER bool old_multibuffer; /* The old value of the multibuffer option, restored after we * load all files on the command line. */ @@ -2063,7 +2063,7 @@ int main(int argc, char **argv) const struct option long_options[] = { {"help", 0, NULL, 'h'}, {"boldtext", 0, NULL, 'D'}, -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER {"multibuffer", 0, NULL, 'F'}, #endif #ifdef ENABLE_NANORC @@ -2194,7 +2194,7 @@ int main(int argc, char **argv) SET(TABS_TO_SPACES); break; #endif -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER case 'F': SET(MULTIBUFFER); break; @@ -2631,7 +2631,7 @@ int main(int argc, char **argv) optind++; } -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER old_multibuffer = ISSET(MULTIBUFFER); SET(MULTIBUFFER); @@ -2686,7 +2686,7 @@ int main(int argc, char **argv) UNSET(VIEW_MODE); } -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER if (!old_multibuffer) UNSET(MULTIBUFFER); #endif diff --git a/src/proto.h b/src/proto.h index 51100091..add47f35 100644 --- a/src/proto.h +++ b/src/proto.h @@ -267,7 +267,7 @@ void open_buffer(const char *filename, bool undoable); void replace_buffer(const char *filename); #endif void display_buffer(void); -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER void switch_to_prevnext_buffer(bool next); void switch_to_prev_buffer_void(void); void switch_to_next_buffer_void(void); diff --git a/src/rcfile.c b/src/rcfile.c index 4e733243..54160891 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -48,7 +48,7 @@ static const rcoption rcopts[] = { #ifndef DISABLE_MOUSE {"mouse", USE_MOUSE}, #endif -#ifdef ENABLE_MULTIBUFFER +#ifndef DISABLE_MULTIBUFFER {"multibuffer", MULTIBUFFER}, #endif {"morespace", MORE_SPACE},