Ignoring magic without libmagic, and ignoring formatter without spell checking.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5175 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-04-03 17:28:30 +00:00
parent de53c53c6e
commit d7ade1f346
2 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,8 @@
2015-04-03 Benno Schulenberg <bensberg@justemail.net> 2015-04-03 Benno Schulenberg <bensberg@justemail.net>
* README: Update text to the fifth milestone: 2.4.x, plus tweaks. * README: Update text to the fifth milestone, 2.4.x, plus tweaks.
* src/rcfile.c: Remove two superfluous (because nested) #ifndefs. * src/rcfile.c: Remove two superfluous (because nested) #ifndefs.
* src/rcfile.c (parse_rcfile): Ignore any magic when libmagic was
disabled, and ignore a formatter when spell checking was disabled.
2015-03-28 Benno Schulenberg <bensberg@justemail.net> 2015-03-28 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (search_init_globals, search_replace_abort), * src/search.c (search_init_globals, search_replace_abort),

View File

@ -903,10 +903,10 @@ void parse_header_exp(char *ptr)
} }
} }
#ifdef HAVE_LIBMAGIC
/* Parse the magic regexes that may influence the choice of syntax. */ /* Parse the magic regexes that may influence the choice of syntax. */
void parse_magic_exp(char *ptr) void parse_magic_exp(char *ptr)
{ {
#ifdef HAVE_LIBMAGIC
regexlisttype *endmagic = NULL; regexlisttype *endmagic = NULL;
assert(ptr != NULL); assert(ptr != NULL);
@ -966,8 +966,8 @@ void parse_magic_exp(char *ptr)
} else } else
free(newmagic); free(newmagic);
} }
#endif /* HAVE_LIBMAGIC */
} }
#endif /* HAVE_LIBMAGIC */
/* Parse the linter requested for this syntax. */ /* Parse the linter requested for this syntax. */
void parse_linter(char *ptr) void parse_linter(char *ptr)
@ -995,6 +995,7 @@ void parse_linter(char *ptr)
endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr); endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr);
} }
#ifndef DISABLE_SPELLER
/* Parse the formatter requested for this syntax. */ /* Parse the formatter requested for this syntax. */
void parse_formatter(char *ptr) void parse_formatter(char *ptr)
{ {
@ -1020,6 +1021,7 @@ void parse_formatter(char *ptr)
else else
endsyntax->formatter = mallocstrcpy(syntaxes->formatter, ptr); endsyntax->formatter = mallocstrcpy(syntaxes->formatter, ptr);
} }
#endif /* !DISABLE_SPELLER */
#endif /* !DISABLE_COLOR */ #endif /* !DISABLE_COLOR */
/* Check whether the user has unmapped every shortcut for a /* Check whether the user has unmapped every shortcut for a
@ -1146,7 +1148,11 @@ void parse_rcfile(FILE *rcstream
parse_syntax(ptr); parse_syntax(ptr);
} }
else if (strcasecmp(keyword, "magic") == 0) else if (strcasecmp(keyword, "magic") == 0)
#ifdef HAVE_LIBMAGIC
parse_magic_exp(ptr); parse_magic_exp(ptr);
#else
;
#endif
else if (strcasecmp(keyword, "header") == 0) else if (strcasecmp(keyword, "header") == 0)
parse_header_exp(ptr); parse_header_exp(ptr);
else if (strcasecmp(keyword, "color") == 0) else if (strcasecmp(keyword, "color") == 0)
@ -1156,7 +1162,11 @@ void parse_rcfile(FILE *rcstream
else if (strcasecmp(keyword, "linter") == 0) else if (strcasecmp(keyword, "linter") == 0)
parse_linter(ptr); parse_linter(ptr);
else if (strcasecmp(keyword, "formatter") == 0) else if (strcasecmp(keyword, "formatter") == 0)
#ifndef DISABLE_SPELLER
parse_formatter(ptr); parse_formatter(ptr);
#else
;
#endif
#endif /* !DISABLE_COLOR */ #endif /* !DISABLE_COLOR */
else if (strcasecmp(keyword, "bind") == 0) else if (strcasecmp(keyword, "bind") == 0)
parse_binding(ptr, TRUE); parse_binding(ptr, TRUE);