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

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

Suggested-by: default avatarBrand Huntsman <alpha@qzx.com>
No related merge requests found
Showing with 9 additions and 0 deletions
+9 -0
...@@ -242,6 +242,8 @@ int interface_color_pair[] = {0}; ...@@ -242,6 +242,8 @@ int interface_color_pair[] = {0};
char *homedir = NULL; char *homedir = NULL;
/* The user's home directory, from $HOME or /etc/passwd. */ /* 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. */ /* Return the number of entries in the shortcut list for a given menu. */
......
...@@ -2594,6 +2594,9 @@ int main(int argc, char **argv) ...@@ -2594,6 +2594,9 @@ int main(int argc, char **argv)
prepare_for_display(); prepare_for_display();
if (rcfile_with_errors != NULL)
statusline(ALERT, _("Mistakes in '%s'"), rcfile_with_errors);
while (TRUE) { while (TRUE) {
#ifdef ENABLE_LINENUMBERS #ifdef ENABLE_LINENUMBERS
int needed_margin = digits(openfile->filebot->lineno) + 1; int needed_margin = digits(openfile->filebot->lineno) + 1;
......
...@@ -181,6 +181,7 @@ extern char* specified_color_combo[NUMBER_OF_ELEMENTS]; ...@@ -181,6 +181,7 @@ extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
extern int interface_color_pair[NUMBER_OF_ELEMENTS]; extern int interface_color_pair[NUMBER_OF_ELEMENTS];
extern char *homedir; extern char *homedir;
extern char *rcfile_with_errors;
typedef void (*functionptrtype)(void); typedef void (*functionptrtype)(void);
......
...@@ -141,6 +141,9 @@ void rcfile_error(const char *msg, ...) ...@@ -141,6 +141,9 @@ void rcfile_error(const char *msg, ...)
{ {
va_list ap; va_list ap;
if (rcfile_with_errors == NULL)
rcfile_with_errors = strdup(nanorc);
if (lineno > 0) if (lineno > 0)
fprintf(stderr, _("Error in %s on line %lu: "), nanorc, (unsigned long)lineno); fprintf(stderr, _("Error in %s on line %lu: "), nanorc, (unsigned long)lineno);
......
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