Commit 46430999 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

build: make --enable-help properly depend on --enable-multibuffer

And in the process transform the token DISABLE_HELP to ENABLE_HELP.
No related merge requests found
Showing with 52 additions and 32 deletions
+52 -32
...@@ -106,9 +106,28 @@ if test "x$enable_extra" = xno; then ...@@ -106,9 +106,28 @@ if test "x$enable_extra" = xno; then
fi fi
AC_ARG_ENABLE(help, AC_ARG_ENABLE(help,
AS_HELP_STRING([--disable-help], [Disable help functions])) AS_HELP_STRING([--disable-help], [Disable built-in help texts]))
if test "x$enable_help" = xno; then if test "x$enable_tiny" = xyes; then
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.]) if test "x$enable_help" = xyes; then
if test "x$enable_multibuffer" != xyes; then
AC_MSG_ERROR([--enable-help cannot work without --enable-multibuffer])
fi
else
enable_help=no
fi
fi
if test "x$enable_multibuffer" = xno; then
if test "x$enable_help" = xyes; then
AC_MSG_ERROR([--enable-help cannot work with --disable-multibuffer])
else
# Disabling multibuffer silently disables the help texts.
enable_help=no
fi
fi
if test "x$disable_help" != xyes; then
if test "x$enable_help" != xno; then
AC_DEFINE(ENABLE_HELP, 1, [Define this to enable the Ctrl+G help texts.])
fi
fi fi
AC_ARG_ENABLE(histories, AC_ARG_ENABLE(histories,
...@@ -230,9 +249,6 @@ if test "x$enable_tiny" = xyes; then ...@@ -230,9 +249,6 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_extra" != xyes; then if test "x$enable_extra" != xyes; then
AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.]) AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.])
fi fi
if test "x$enable_help" != xyes; then
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
fi
if test "x$enable_histories" != xyes; then if test "x$enable_histories" != xyes; then
AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.]) AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.])
fi fi
......
...@@ -162,7 +162,7 @@ char *do_browser(char *path) ...@@ -162,7 +162,7 @@ char *do_browser(char *path)
kbinput = KEY_WINCH; kbinput = KEY_WINCH;
#endif #endif
} else if (func == do_help_void) { } else if (func == do_help_void) {
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
do_help_void(); do_help_void();
#ifndef NANO_TINY #ifndef NANO_TINY
/* The window dimensions might have changed, so act as if. */ /* The window dimensions might have changed, so act as if. */
......
...@@ -314,7 +314,7 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h ...@@ -314,7 +314,7 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
f->menus = menus; f->menus = menus;
f->desc = desc; f->desc = desc;
f->viewok = viewok; f->viewok = viewok;
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
f->help = help; f->help = help;
f->blank_after = blank_after; f->blank_after = blank_after;
#endif #endif
...@@ -480,7 +480,7 @@ void shortcut_init(void) ...@@ -480,7 +480,7 @@ void shortcut_init(void)
/* TRANSLATORS: Try to keep this string at most 12 characters. */ /* TRANSLATORS: Try to keep this string at most 12 characters. */
const char *whereis_next_tag = N_("WhereIs Next"); const char *whereis_next_tag = N_("WhereIs Next");
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
#ifndef DISABLE_JUSTIFY #ifndef DISABLE_JUSTIFY
/* TRANSLATORS: The next long series of strings are shortcut descriptions; /* TRANSLATORS: The next long series of strings are shortcut descriptions;
* they are best kept shorter than 56 characters, but may be longer. */ * they are best kept shorter than 56 characters, but may be longer. */
...@@ -642,9 +642,9 @@ void shortcut_init(void) ...@@ -642,9 +642,9 @@ void shortcut_init(void)
const char *nano_formatter_msg = N_("Invoke formatter, if available"); const char *nano_formatter_msg = N_("Invoke formatter, if available");
#endif #endif
#endif #endif
#endif /* !DISABLE_HELP */ #endif /* ENABLE_HELP */
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
#define IFSCHELP(help) help #define IFSCHELP(help) help
#else #else
#define IFSCHELP(help) "" #define IFSCHELP(help) ""
...@@ -709,7 +709,7 @@ void shortcut_init(void) ...@@ -709,7 +709,7 @@ void shortcut_init(void)
N_("Go To Dir"), IFSCHELP(nano_gotodir_msg), BLANKAFTER, VIEW); N_("Go To Dir"), IFSCHELP(nano_gotodir_msg), BLANKAFTER, VIEW);
#endif #endif
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
/* The description ("x") and blank_after (0) are irrelevant, /* The description ("x") and blank_after (0) are irrelevant,
* because the help viewer does not have a help text. */ * because the help viewer does not have a help text. */
add_to_funcs(do_exit, MHELP, exit_tag, "x", 0, VIEW); add_to_funcs(do_exit, MHELP, exit_tag, "x", 0, VIEW);
...@@ -1290,7 +1290,7 @@ void shortcut_init(void) ...@@ -1290,7 +1290,7 @@ void shortcut_init(void)
#ifndef DISABLE_BROWSER #ifndef DISABLE_BROWSER
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0); add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
#endif #endif
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
add_to_sclist(MHELP, "^G", 0, do_exit, 0); add_to_sclist(MHELP, "^G", 0, do_exit, 0);
add_to_sclist(MHELP, "Home", KEY_HOME, do_first_line, 0); add_to_sclist(MHELP, "Home", KEY_HOME, do_first_line, 0);
add_to_sclist(MHELP, "End", KEY_END, do_last_line, 0); add_to_sclist(MHELP, "End", KEY_END, do_last_line, 0);
...@@ -1403,7 +1403,7 @@ sc *strtosc(const char *input) ...@@ -1403,7 +1403,7 @@ sc *strtosc(const char *input)
s->toggle = 0; s->toggle = 0;
#endif #endif
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
if (!strcasecmp(input, "help")) if (!strcasecmp(input, "help"))
s->scfunc = do_help_void; s->scfunc = do_help_void;
else else
...@@ -1681,7 +1681,7 @@ int strtomenu(const char *input) ...@@ -1681,7 +1681,7 @@ int strtomenu(const char *input)
else if (!strcasecmp(input, "externalcmd") || else if (!strcasecmp(input, "externalcmd") ||
!strcasecmp(input, "extcmd")) !strcasecmp(input, "extcmd"))
return MEXTCMD; return MEXTCMD;
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
else if (!strcasecmp(input, "help")) else if (!strcasecmp(input, "help"))
return MHELP; return MHELP;
#endif #endif
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
static char *help_text = NULL; static char *help_text = NULL;
/* The text displayed in the help window. */ /* The text displayed in the help window. */
...@@ -631,17 +631,17 @@ size_t help_line_len(const char *ptr) ...@@ -631,17 +631,17 @@ size_t help_line_len(const char *ptr)
return 0; return 0;
} }
#endif /* !DISABLE_HELP */ #endif /* ENABLE_HELP */
/* Start the help viewer. */ /* Start the help viewer. */
void do_help_void(void) void do_help_void(void)
{ {
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
do_help(); do_help();
#else #else
if (currmenu == MMAIN) if (currmenu == MMAIN)
say_there_is_no_help(); say_there_is_no_help();
else else
beep(); beep();
#endif /* !DISABLE_HELP */ #endif
} }
...@@ -539,7 +539,7 @@ void show_restricted_warning(void) ...@@ -539,7 +539,7 @@ void show_restricted_warning(void)
beep(); beep();
} }
#ifdef DISABLE_HELP #ifndef ENABLE_HELP
/* Indicate that help texts are unavailable. */ /* Indicate that help texts are unavailable. */
void say_there_is_no_help(void) void say_there_is_no_help(void)
{ {
...@@ -928,7 +928,7 @@ void version(void) ...@@ -928,7 +928,7 @@ void version(void)
#ifndef DISABLE_EXTRA #ifndef DISABLE_EXTRA
printf(" --enable-extra"); printf(" --enable-extra");
#endif #endif
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
printf(" --enable-help"); printf(" --enable-help");
#endif #endif
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
...@@ -977,7 +977,7 @@ void version(void) ...@@ -977,7 +977,7 @@ void version(void)
#ifdef DISABLE_EXTRA #ifdef DISABLE_EXTRA
printf(" --disable-extra"); printf(" --disable-extra");
#endif #endif
#ifdef DISABLE_HELP #ifndef ENABLE_HELP
printf(" --disable-help"); printf(" --disable-help");
#endif #endif
#ifdef DISABLE_HISTORIES #ifdef DISABLE_HISTORIES
......
...@@ -442,7 +442,7 @@ typedef struct subnfunc { ...@@ -442,7 +442,7 @@ typedef struct subnfunc {
/* In what menus this function applies. */ /* In what menus this function applies. */
const char *desc; const char *desc;
/* The function's short description, for example "Where Is". */ /* The function's short description, for example "Where Is". */
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
const char *help; const char *help;
/* The help-screen text for this function. */ /* The help-screen text for this function. */
bool blank_after; bool blank_after;
......
...@@ -340,7 +340,7 @@ void thanks_for_all_the_fish(void); ...@@ -340,7 +340,7 @@ void thanks_for_all_the_fish(void);
#endif #endif
/* All functions in help.c. */ /* All functions in help.c. */
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
void display_the_help_text(bool redisplaying); void display_the_help_text(bool redisplaying);
void do_help(void); void do_help(void);
void help_init(void); void help_init(void);
...@@ -401,7 +401,7 @@ void unlink_opennode(openfilestruct *fileptr); ...@@ -401,7 +401,7 @@ void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr); void delete_opennode(openfilestruct *fileptr);
void print_view_warning(void); void print_view_warning(void);
void show_restricted_warning(void); void show_restricted_warning(void);
#ifdef DISABLE_HELP #ifndef ENABLE_HELP
void say_there_is_no_help(void); void say_there_is_no_help(void);
#endif #endif
void finish(void); void finish(void);
...@@ -545,7 +545,7 @@ void update_undo(undo_type action); ...@@ -545,7 +545,7 @@ void update_undo(undo_type action);
void wrap_reset(void); void wrap_reset(void);
bool do_wrap(filestruct *line); bool do_wrap(filestruct *line);
#endif #endif
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY) #if defined(ENABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl); ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
#endif #endif
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY) #if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
...@@ -601,8 +601,10 @@ size_t actual_x(const char *s, size_t column); ...@@ -601,8 +601,10 @@ size_t actual_x(const char *s, size_t column);
size_t strnlenpt(const char *s, size_t maxlen); size_t strnlenpt(const char *s, size_t maxlen);
size_t strlenpt(const char *s); size_t strlenpt(const char *s);
void new_magicline(void); void new_magicline(void);
#ifndef NANO_TINY #if !defined(NANO_TINY) || defined(ENABLE_HELP)
void remove_magicline(void); void remove_magicline(void);
#endif
#ifndef NANO_TINY
void mark_order(const filestruct **top, size_t *top_x, const filestruct void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up); **bot, size_t *bot_x, bool *right_side_up);
#endif #endif
......
...@@ -1608,7 +1608,7 @@ bool do_wrap(filestruct *line) ...@@ -1608,7 +1608,7 @@ bool do_wrap(filestruct *line)
} }
#endif /* !DISABLE_WRAPPING */ #endif /* !DISABLE_WRAPPING */
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY) #if defined(ENABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
/* We are trying to break a chunk off line. We find the last blank such /* We are trying to break a chunk off line. We find the last blank such
* that the display length to there is at most (goal + 1). If there is * that the display length to there is at most (goal + 1). If there is
* no such blank, then we find the first blank. We then take the last * no such blank, then we find the first blank. We then take the last
...@@ -1643,7 +1643,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl) ...@@ -1643,7 +1643,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
if (column <= goal) if (column <= goal)
return index; return index;
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
/* If we're wrapping a help text and no blank was found, or was /* If we're wrapping a help text and no blank was found, or was
* found only as the first character, force a line break. */ * found only as the first character, force a line break. */
if (snap_at_nl && lastblank < 1) if (snap_at_nl && lastblank < 1)
...@@ -1680,7 +1680,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl) ...@@ -1680,7 +1680,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
return lastblank; return lastblank;
} }
#endif /* !DISABLE_HELP || !DISABLE_WRAPJUSTIFY */ #endif /* ENABLE_HELP || !DISABLE_WRAPJUSTIFY */
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY) #if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
/* The "indentation" of a line is the whitespace between the quote part /* The "indentation" of a line is the whitespace between the quote part
......
...@@ -452,7 +452,7 @@ void new_magicline(void) ...@@ -452,7 +452,7 @@ void new_magicline(void)
openfile->totsize++; openfile->totsize++;
} }
#ifndef NANO_TINY #if !defined(NANO_TINY) || defined(ENABLE_HELP)
/* Remove the magicline from filebot, if there is one and it isn't the /* Remove the magicline from filebot, if there is one and it isn't the
* only line in the file. Assume that edittop and current are not at * only line in the file. Assume that edittop and current are not at
* filebot. */ * filebot. */
...@@ -466,7 +466,9 @@ void remove_magicline(void) ...@@ -466,7 +466,9 @@ void remove_magicline(void)
openfile->totsize--; openfile->totsize--;
} }
} }
#endif
#ifndef NANO_TINY
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark, /* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
* respectively, based on the locations of top and bot. If * respectively, based on the locations of top and bot. If
* right_side_up isn't NULL, set it to TRUE if the mark begins with * right_side_up isn't NULL, set it to TRUE if the mark begins with
......
...@@ -3145,7 +3145,7 @@ void total_refresh(void) ...@@ -3145,7 +3145,7 @@ void total_refresh(void)
{ {
total_redraw(); total_redraw();
titlebar(title); titlebar(title);
#ifndef DISABLE_HELP #ifdef ENABLE_HELP
if (inhelp) if (inhelp)
display_the_help_text(TRUE); display_the_help_text(TRUE);
else else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment