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

Suggested-by: Brand Huntsman <alpha@qzx.com>
This commit is contained in:
Benno Schulenberg 2017-10-28 14:18:37 +02:00
parent c3a11fb7ed
commit 1463781247
4 changed files with 9 additions and 0 deletions

View File

@ -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. */

View File

@ -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;

View File

@ -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);

View File

@ -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);