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.
master
Benno Schulenberg 2019-06-14 10:26:49 +02:00
parent e3f18e7a6c
commit 19f71632c8
1 changed files with 2 additions and 8 deletions

View File

@ -1029,6 +1029,8 @@ void parse_rcfile(FILE *rcstream, bool syntax_only, bool headers_only)
char *syntaxname = ptr; char *syntaxname = ptr;
syntaxtype *sint; syntaxtype *sint;
opensyntax = FALSE;
ptr = parse_next_word(ptr); ptr = parse_next_word(ptr);
for (sint = syntaxes; sint != NULL; sint = sint->next) 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) { if (sint == NULL) {
rcfile_error(N_("Could not find syntax \"%s\" to extend"), rcfile_error(N_("Could not find syntax \"%s\" to extend"),
syntaxname); syntaxname);
opensyntax = FALSE;
continue; continue;
} }
/* Disallow extending a syntax that is defined in a main nanorc. */ /* Disallow extending a syntax that is defined in a main nanorc. */
if (sint->filename == NULL) { if (sint->filename == NULL) {
rcfile_error(N_("Only an 'include' syntax can be extended")); rcfile_error(N_("Only an 'include' syntax can be extended"));
opensyntax = FALSE;
continue; continue;
} }
@ -1123,12 +1123,6 @@ void parse_rcfile(FILE *rcstream, bool syntax_only, bool headers_only)
else if (headers_only) else if (headers_only)
rcfile_error(N_("Command \"%s\" not understood"), keyword); 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) if (set == 0)
continue; continue;