nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit d152ad378b878e9830e359714989684ad68af2d1
parent 5a584ccda333ab96f3d460857ee06914aad3ddeb
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Mon,  1 Aug 2005 04:59:34 +0000

port over Brand Huntsman's reserved "none" syntax to counteract his
"default" syntax when necessary (the latter *is* actually ported mostly
from his patch with a few tweaks; the "default-syntax" option is
apparently something else entirely)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2961 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 5+++--
Mdoc/nanorc.sample | 7++++---
Msrc/color.c | 5+++++
Msrc/rcfile.c | 10+++++++++-
4 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -53,9 +53,10 @@ CVS code - regex strings constantly, and to actually compile them on an as-needed basis. Also, make a color syntax specified on the command line override the syntax associated with the current - file extension, and add a "default" syntax that takes no + file extension, add a "default" syntax that takes no extensions for those files that don't match any other - syntax's extensions. Changes to update_color(), + syntax's extensions, and add a "none" syntax that's the same + as having no syntax at all. Changes to update_color(), thanks_for_all_the_fish(), nregcomp(), parse_syntax(), and parse_colors(). (Brand Huntsman and DLR) - Various other color fixes. Handle unspecified foreground diff --git a/doc/nanorc.sample b/doc/nanorc.sample @@ -147,9 +147,10 @@ ## ## syntax "short description" ["filename regex" ...] ## -## (The syntax "default" is reserved: it takes no filename regexes, and -## applies to files that don't match any other syntax's filename -## regexes.) +## (The "none" syntax is reserved; specifying it on the command line is +## the same as not having a syntax at all. The "default" syntax is +## special: it takes no filename regexes, and applies to files that +## don't match any other syntax's filename regexes.) ## ## color foreground,background "regex" ["regex"...] ## or diff --git a/src/color.c b/src/color.c @@ -117,6 +117,11 @@ void color_update(void) /* If we specified a syntax override string, use it. */ if (syntaxstr != NULL) { + /* If the syntax override is "none", it's the same as not having + * a syntax at all, so get out. */ + if (strcmp(syntaxstr, "none") == 0) + return; + for (tmpsyntax = syntaxes; tmpsyntax != NULL; tmpsyntax = tmpsyntax->next) { if (strcmp(tmpsyntax->desc, syntaxstr) == 0) diff --git a/src/rcfile.c b/src/rcfile.c @@ -322,9 +322,17 @@ void parse_syntax(char *ptr) fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr); #endif + /* The "none" syntax is the same as not having a syntax at all, so + * we can't assign any extensions or colors to it. */ + if (strcmp(endsyntax->desc, "none") == 0) { + rcfile_error(N_("The \"none\" syntax is reserved")); + return; + } + /* The default syntax should have no associated extensions. */ if (strcmp(endsyntax->desc, "default") == 0 && *ptr != '\0') { - rcfile_error(N_("The default syntax must take no extensions")); + rcfile_error( + N_("The \"default\" syntax must take no extensions")); return; }