From 19f71632c850acb04d8dff3033b59b3c9a8f9ae3 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 14 Jun 2019 10:26:49 +0200 Subject: [PATCH] tweaks: remove an unneeded "closing" of a syntax after extending it As 'extendsyntax' commands are no longer interpreted immediately when the rcfiles are read, there is no need to set 'opensyntax' to FALSE after interpreting such a command -- for a single syntax they are all interpreted in a row. --- src/rcfile.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/rcfile.c b/src/rcfile.c index 205bba83..ac29a21f 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1029,6 +1029,8 @@ void parse_rcfile(FILE *rcstream, bool syntax_only, bool headers_only) char *syntaxname = ptr; syntaxtype *sint; + opensyntax = FALSE; + ptr = parse_next_word(ptr); for (sint = syntaxes; sint != NULL; sint = sint->next) @@ -1038,14 +1040,12 @@ void parse_rcfile(FILE *rcstream, bool syntax_only, bool headers_only) if (sint == NULL) { rcfile_error(N_("Could not find syntax \"%s\" to extend"), syntaxname); - opensyntax = FALSE; continue; } /* Disallow extending a syntax that is defined in a main nanorc. */ if (sint->filename == NULL) { rcfile_error(N_("Only an 'include' syntax can be extended")); - opensyntax = FALSE; continue; } @@ -1123,12 +1123,6 @@ void parse_rcfile(FILE *rcstream, bool syntax_only, bool headers_only) else if (headers_only) rcfile_error(N_("Command \"%s\" not understood"), keyword); -#ifdef ENABLE_COLOR - /* If a syntax was extended, it stops at the end of the command. */ - if (!syntax_only && live_syntax != syntaxes) - opensyntax = FALSE; -#endif - if (set == 0) continue;