nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 14637812471cb6caebb845c233b0a2035796f854
parent c3a11fb7edcff930be065ca609bc255bcef2b104
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat, 28 Oct 2017 14:18:37 +0200

startup: when an rcfile contains errors, report this on the status bar

Suggested-by: Brand Huntsman <alpha@qzx.com>

Diffstat:
Msrc/global.c | 2++
Msrc/nano.c | 3+++
Msrc/proto.h | 1+
Msrc/rcfile.c | 3+++
4 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -242,6 +242,8 @@ int interface_color_pair[] = {0}; char *homedir = NULL; /* The user's home directory, from $HOME or /etc/passwd. */ +char *rcfile_with_errors = NULL; + /* The first nanorc file, if any, that produced warnings. */ /* Return the number of entries in the shortcut list for a given menu. */ diff --git a/src/nano.c b/src/nano.c @@ -2594,6 +2594,9 @@ int main(int argc, char **argv) prepare_for_display(); + if (rcfile_with_errors != NULL) + statusline(ALERT, _("Mistakes in '%s'"), rcfile_with_errors); + while (TRUE) { #ifdef ENABLE_LINENUMBERS int needed_margin = digits(openfile->filebot->lineno) + 1; diff --git a/src/proto.h b/src/proto.h @@ -181,6 +181,7 @@ extern char* specified_color_combo[NUMBER_OF_ELEMENTS]; extern int interface_color_pair[NUMBER_OF_ELEMENTS]; extern char *homedir; +extern char *rcfile_with_errors; typedef void (*functionptrtype)(void); diff --git a/src/rcfile.c b/src/rcfile.c @@ -141,6 +141,9 @@ void rcfile_error(const char *msg, ...) { va_list ap; + if (rcfile_with_errors == NULL) + rcfile_with_errors = strdup(nanorc); + if (lineno > 0) fprintf(stderr, _("Error in %s on line %lu: "), nanorc, (unsigned long)lineno);