* global.c (shortcut_init) - fix an issue with the split
do_research() setup when using --enable-tiny
* rcfile.c (parse_linter) - Allow linter to be unset using ""
* rcfile.c - Allow syntaxes to be extended via "extendsyntax"
directive. Color, header, magic and linter should all be
able to be extended. Man page updates for nanorc(5).
* doc/nanorc.sample.in - Document 'set quiet'
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4630
35c25a1d-7b9e-4130-9fde-
d3aeb78583b8
+2014-03-01 Chris Allegretta <chrisa@asty.org>
+ * global.c (shortcut_init) - fix an issue with the split
+ do_research() setup when using --enable-tiny
+ * rcfile.c (parse_linter) - Allow linter to be unset using ""
+ * rcfile.c - Allow syntaxes to be extended via "extendsyntax"
+ directive. Color, header, magic and linter should all be
+ able to be extended. Man page updates for nanorc(5).
+ * doc/nanorc.sample.in - Document 'set quiet'
+
2014-03-01 Mike Frysinger <vapier@gentoo.org>
* src/color.c (color_update) - Do not write to stderr on magic
errors. If the magic db has errors such that magic_load() fails,
Read in self-contained color syntaxes from \fIsyntaxfile\fP. Note that
\fIsyntaxfile\fP can only contain \fBsyntax\fP, \fBcolor\fP, and
\fBicolor\fP commands.
+.TP
+.B extendsyntax \fIstr\fP \fIdirective\fP [ \fIarg\fP ... ]
+Extend the syntax previously defined as \fIstr\fP to include
+new information. Allows you to add a new \fIcolor\fP, \fIicolor\fP,
+\fImagic\fP, \fIheader\fP, or \fIlinter\fP directive to a syntax
+defined. Useful when you want to add to definitions from the
+system-installed syntax definitions (which are normally not writable).
.SH KEY BINDINGS
Key bindings may be reassigned via the following commands:
## its end. For example, for the "brackets" option, ""')>]}" will match
## ", ', ), >, ], and }.
+## Silently ignore problems with unknown directives in the nanorc file.
+## Useful when your nanorc file might be read on systems with multiple
+## versions of nano installed (e.g. your home directory is on NFS)
+# set quiet
+
## Use auto-indentation.
# set autoindent
add_to_funcs(do_search, MMAIN|MBROWSER, whereis_msg,
IFSCHELP(nano_whereis_msg), FALSE, VIEW);
+#ifndef NANO_TINY
add_to_funcs(do_research, MBROWSER, whereis_next_msg,
IFSCHELP(nano_whereis_next_msg), TRUE, VIEW);
+#endif /* NANO_TINY */
#ifndef DISABLE_JUSTIFY
/* TRANSLATORS: Try to keep this at most 10 characters. */
#ifdef DEBUG
fprintf(stderr, "Adding new entry for fg %hd, bg %hd\n", fg, bg);
#endif
+ /* Need to recompute endcolor now so we can extend colors to syntaxes */
+ for (endcolor = endsyntax->color; endcolor->next != NULL; endcolor = endcolor->next)
+ ;
endcolor->next = newcolor;
}
if (endsyntax->linter != NULL)
free(endsyntax->linter);
- endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr);
+ /* Let them unset the linter by using "" */
+ if (!strcmp(ptr, "\"\""))
+ endsyntax->linter = NULL;
+ else
+ endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr);
}
#endif /* ENABLE_COLOR */
char *buf = NULL;
ssize_t len;
size_t n = 0;
+#ifdef ENABLE_COLOR
+ syntaxtype *end_syn_save = NULL;
+#endif
while ((len = getline(&buf, &n, rcstream)) > 0) {
char *ptr, *keyword, *option;
keyword = ptr;
ptr = parse_next_word(ptr);
+
+ /* Handle extending first... */
+ if (strcasecmp(keyword, "extendsyntax") == 0) {
+ char *syntaxname = ptr;
+ syntaxtype *ts = NULL;
+
+ ptr = parse_next_word(ptr);
+ for (ts = syntaxes; ts != NULL; ts = ts->next)
+ if (!strcmp(ts->desc, syntaxname))
+ break;
+
+ if (ts == NULL) {
+ rcfile_error(N_("Could not find syntax \"%s\" to extend"), syntaxname);
+ continue;
+ } else {
+ end_syn_save = endsyntax;
+ endsyntax = ts;
+ keyword = ptr;
+ ptr = parse_next_word(ptr);
+ }
+ }
+
/* Try to parse the keyword. */
if (strcasecmp(keyword, "set") == 0) {
#ifdef ENABLE_COLOR
else
rcfile_error(N_("Command \"%s\" not understood"), keyword);
+#ifdef ENABLE_COLOR
+ /* If we temporarily reset emdsyntax to allow extending, reset
+ the value here */
+ if (end_syn_save != NULL) {
+ endsyntax = end_syn_save;
+ end_syn_save = NULL;
+ }
+#endif
+
if (set == 0)
continue;