* New option -q, --quiet, rcfile option "quiet" implemented. Skips printing
errors about the rcfile and asking user to press enter. Also, nano should
now only ask for one enter press when there is an error when not using -q.
Based on discussion between Eitan Adler and Mike Frysinger.
* rcfile.c (parse_keybinding) - Significant cleanups and fixes for
detecting and reporting errors in key bindings code.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4374
35c25a1d-7b9e-4130-9fde-
d3aeb78583b8
+2009-02-09 Chris Allegretta <chrisa@asty.org>
+ * New option -q, --quiet, rcfile option "quiet" implemented. Skips printing
+ errors about the rcfile and asking user to press enter. Also, nano should
+ now only ask for one enter press when there is an error when not using -q.
+ Based on discussion between Eitan Adler and Mike Frysinger.
+ * rcfile.c (parse_keybinding) - Significant cleanups and fixes for
+ detecting and reporting errors in key bindings code.
+
2009-02-08 Chris Allegretta <chrisa@asty.org>
* Make reset_multidata reset more lines, since contrary to previous problems the
syntax highlting is now too *un*ambitious, causing display glitches when
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
by the terminal.
.TP
+.B \-q (\-\-quiet)
+Do not report errors in the nanorc file and ask them to
+be acknowledged by pressing enter at startup.
+.TP
.B \-r \fIcols\fP (\-\-fill=\fIcols\fP)
Wrap lines at column \fIcols\fP. If this value is 0 or less, wrapping
will occur at the width of the screen less \fIcols\fP columns, allowing
punctuation, optionally followed by closing brackets, can end sentences.
The default value is "\fI!.?\fP".
.TP
+.B set/unset quiet
+\fBnano\fP will not report errors in the nanorc file and ask them to
+be acknowledged by pressing enter at startup. If this is used it should
+be placed at the top of the file to be fully effective.
+.TP
.B set/unset quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
keystroke instead of 25.
#endif
print_opt("-p", "--preserve",
N_("Preserve XON (^Q) and XOFF (^S) keys"));
+ print_opt("-q", "--quiet",
+ N_("Silently ignore startup issues like rc file errors"));
#ifndef DISABLE_WRAPJUSTIFY
print_opt(_("-r <#cols>"), _("--fill=<#cols>"),
N_("Set wrapping point at column #cols"));
{"operatingdir", 1, NULL, 'o'},
#endif
{"preserve", 0, NULL, 'p'},
+ {"quiet", 0, NULL, 'q'},
#ifndef DISABLE_WRAPJUSTIFY
{"fill", 1, NULL, 'r'},
#endif
while ((optchr =
#ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv,
- "h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz",
+ "h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pqr:s:tvwxz",
long_options, NULL)
#else
getopt(argc, argv,
- "h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz")
+ "h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pqr:s:tvwxz")
#endif
) != -1) {
switch (optchr) {
case 'p':
SET(PRESERVE);
break;
+ case 'q':
+ SET(QUIET);
+ break;
#ifndef DISABLE_WRAPJUSTIFY
case 'r':
if (!parse_num(optarg, &wrap_at)) {
#define WORD_BOUNDS (1<<28)
#define NO_NEWLINES (1<<29)
#define BOLD_TEXT (1<<30)
+#define QUIET (1<<31)
/* Flags for which menus in which a given function should be present */
#define MMAIN (1<<0)
{"historylog", HISTORYLOG},
{"matchbrackets", 0},
{"noconvert", NO_CONVERT},
+ {"quiet", QUIET},
{"quickblank", QUICK_BLANK},
{"smarthome", SMART_HOME},
{"smooth", SMOOTH_SCROLL},
{
va_list ap;
+ if (ISSET(QUIET))
+ return;
+
fprintf(stderr, "\n");
if (lineno > 0) {
errors = TRUE;
if (keycopy[0] != 'M' && keycopy[0] != '^' && keycopy[0] != 'F' && keycopy[0] != 'K') {
rcfile_error(
- N_("keybindings must begin with \"^\", \"M\", or \"F\"\n"));
+ N_("keybindings must begin with \"^\", \"M\", or \"F\""));
return;
}
funcptr = ptr;
ptr = parse_next_word(ptr);
- if (funcptr == NULL) {
+ if (!strcmp(funcptr, "")) {
rcfile_error(
- N_("Must specify function to bind key to\n"));
+ N_("Must specify function to bind key to"));
return;
}
menuptr = ptr;
ptr = parse_next_word(ptr);
- if (menuptr == NULL) {
+ if (!strcmp(menuptr, "")) {
rcfile_error(
/* Note to translators, do not translate the word "all"
in the sentence below, everything else is fine */
- N_("Must specify menu bind key to (or \"all\")\n"));
+ N_("Must specify menu to bind key to (or \"all\")"));
return;
}
- menu = strtomenu(menuptr);
- if (menu < 1) {
+ newsc = strtosc(menu, funcptr);
+ if (newsc == NULL) {
rcfile_error(
- N_("Could not map name \"%s\" to a menu\n"), menuptr);
+ N_("Could not map name \"%s\" to a function"), funcptr);
return;
}
- newsc = strtosc(menu, funcptr);
- if (newsc == NULL) {
+ menu = strtomenu(menuptr);
+ if (menu < 1) {
rcfile_error(
- N_("Could not map name \"%s\" to a function\n"), funcptr);
+ N_("Could not map name \"%s\" to a menu"), menuptr);
return;
}
if (check_bad_binding(newsc)) {
rcfile_error(
- N_("Sorry, keystr \"%s\" is an illegal binding\n"), newsc->keystr);
+ N_("Sorry, keystr \"%s\" is an illegal binding"), newsc->keystr);
return;
}
lineno = 0;
check_vitals_mapped();
-
- if (errors) {
- errors = FALSE;
- fprintf(stderr,
- _("\nPress Enter to continue starting nano.\n"));
- while (getchar() != '\n')
- ;
- }
-
return;
}
free(nanorc);
nanorc = NULL;
+ if (errors && !ISSET(QUIET)) {
+ errors = FALSE;
+ fprintf(stderr,
+ _("\nPress Enter to continue starting nano.\n"));
+ while (getchar() != '\n')
+ ;
+ }
+
#ifdef ENABLE_COLOR
set_colorpairs();
#endif