[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 3/3] startup: when an rcfile contains errors, report
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] [PATCH 3/3] startup: when an rcfile contains errors, report this on the status bar |
Date: |
Sat, 28 Oct 2017 17:46:24 +0200 |
Suggested-by: Brand Huntsman <address@hidden>
---
src/global.c | 2 ++
src/nano.c | 3 +++
src/proto.h | 1 +
src/rcfile.c | 3 +++
4 files changed, 9 insertions(+)
diff --git a/src/global.c b/src/global.c
index 8e125b5d..85c82379 100644
--- 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
index 867b4295..e8cfece5 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2592,6 +2592,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
index 7dfcccc3..9452749e 100644
--- 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
index c58bb015..a8b4d342 100644
--- 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);
--
2.14.1
- [Nano-devel] [PATCH 3/3] startup: when an rcfile contains errors, report this on the status bar,
Benno Schulenberg <=