commit 6d873d376040628040220efd3e66be31fed88e7f
parent 85a8e5cfd2fe1b4cb8647767423129b486dc6686
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Mon, 6 Mar 2017 22:07:57 +0100
startup: add option 'nopauses' to disable pausing after a warning
This addresses a followup of https://savannah.gnu.org/bugs/?50362.
Reported-by: Mike Frysinger <vapier@gentoo.org>
Diffstat:
7 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/doc/nano.texi b/doc/nano.texi
@@ -743,6 +743,10 @@ Don't convert files from DOS/Mac format.
@item set nohelp
Don't display the help lists at the bottom of the screen.
+@item set nopauses
+Don't pause between warnings at startup. This means that only
+the last one will be visible (when there are multiple ones).
+
@item set nonewlines
Don't add newlines to the ends of files.
diff --git a/doc/nanorc.5 b/doc/nanorc.5
@@ -151,6 +151,10 @@ Don't display the two help lines at the bottom of the screen.
.B set nonewlines
Don't automatically add a newline to the ends of files.
.TP
+.B set nopauses
+Don't pause between warnings at startup. This means that only
+the last one will be visible (when there are multiple ones).
+.TP
.B set nowrap
Don't hard-wrap text at all.
.TP
diff --git a/doc/sample.nanorc.in b/doc/sample.nanorc.in
@@ -95,6 +95,10 @@
## Don't display the helpful shortcut lists at the bottom of the screen.
# set nohelp
+## Don't pause between warnings at startup. Which means that only the
+## last one will be readable (when there are multiple ones).
+# set nopauses
+
## Don't add newlines to the ends of files.
# set nonewlines
diff --git a/src/nano.h b/src/nano.h
@@ -509,7 +509,8 @@ enum
MAKE_IT_UNIX,
JUSTIFY_TRIM,
SHOW_CURSOR,
- LINE_NUMBERS
+ LINE_NUMBERS,
+ NO_PAUSES
};
/* Flags for the menus in which a given function should be present. */
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -62,6 +62,7 @@ static const rcoption rcopts[] = {
#endif
{"nohelp", NO_HELP},
{"nonewlines", NO_NEWLINES},
+ {"nopauses", NO_PAUSES},
#ifndef DISABLE_WRAPPING
{"nowrap", NO_WRAP},
#endif
@@ -1292,7 +1293,7 @@ void do_rcfiles(void)
free(nanorc);
- if (errors && !ISSET(QUIET)) {
+ if (errors && !ISSET(QUIET) && !ISSET(NO_PAUSES)) {
errors = FALSE;
fprintf(stderr, _("\nPress Enter to continue starting nano.\n"));
while (getchar() != '\n')
diff --git a/src/winio.c b/src/winio.c
@@ -2111,11 +2111,11 @@ void statusline(message_type importance, const char *msg, ...)
/* Shortly pause after each of the first three alert messages,
* to give the user time to read them. */
- if (lastmessage == ALERT && alerts < 4)
+ if (lastmessage == ALERT && alerts < 4 && !ISSET(NO_PAUSES))
napms(1200);
if (importance == ALERT) {
- if (++alerts > 3)
+ if (++alerts > 3 && !ISSET(NO_PAUSES))
msg = _("Further warnings were suppressed");
beep();
}
diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc
@@ -7,7 +7,7 @@ comment "#"
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|comment|magic|linter|i?color|extendsyntax).*$"
# Keywords
-icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cut|fill[[:space:]]+[[:digit:]]+|historylog|justifytrim|locking|morespace|mouse|multibuffer|noconvert|nohelp|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[[:digit:]]+|tabstospaces|tempfile|unix|view|wordbounds)\>"
+icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cut|fill[[:space:]]+[[:digit:]]+|historylog|justifytrim|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[[:digit:]]+|tabstospaces|tempfile|unix|view|wordbounds)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+((function|key|number|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>" "[[:space:]]+[[:digit:]]+$"
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"