Add $SuppressImplicitWarnings system variable.

This suppresses warnings about missing REM or MSG tokens.
This commit is contained in:
Dianne Skoll
2024-09-15 09:39:15 -04:00
parent 0806b6738f
commit ee1c931932
8 changed files with 24 additions and 7 deletions

View File

@@ -143,7 +143,7 @@
"$NumTrig" "$October" "$On" "$OnceFile" "$ParseUntriggered" "$Pm"
"$PrefixLineNo" "$PSCal" "$RunOff" "$Saturday" "$September"
"$SimpleCal" "$SortByDate" "$SortByPrio" "$SortByTime" "$SubsIndent"
"$Sunday" "$SuppressLRM" "$SysInclude" "$T" "$Td"
"$Sunday" "$SuppressImplicitWarnings" "$SuppressLRM" "$SysInclude" "$T" "$Td"
"$TerminalBackground" "$Thursday" "$TimeSep" "$Tm" "$Today"
"$Tomorrow" "$Tt" "$Tuesday" "$Tw" "$Ty" "$U" "$Ud" "$Um"
"$UntimedFirst" "$Use256Colors" "$UseBGVTColors" "$UseTrueColors"

View File

@@ -2825,8 +2825,15 @@ order, or 2 if sorting by time in descending order.
The number of spaces by which all lines (except the first) of an
\fBMSF\fR-type reminder should be indented. The default is 0.
.TP
.B $SuppressImplicitWarnings
Normally, \fBRemind\fR issues a warning if a line begins with an unknown
token and is treated as a \fBREM\fR command, or if a \fBREM\fR command
is missing a type and is treated as a \fBMSG\fR-type reminder. Setting
\fB$SuppressImplicitWarnings\fR to 1 suppresses these warnings. The default
is 0 and we do not recommend disabling the warnings.
.TP
.B $SuppressLRM
Normally, when Remind is run with the \fB\-c\fR option in a UTF-8 locale,
Normally, when \fBRemind\fR is run with the \fB\-c\fR option in a UTF-8 locale,
it emits a left-to-right mark sequence after printing day names or
reminders. Some terminals render this incorrectly, so you can use:
.RS

View File

@@ -1724,8 +1724,10 @@ static void GenerateCalEntries(int col)
/* need to destroy it here. */
default:
Wprint("Unrecognized command; interpreting as REM");
WarnedAboutImplicit = 1;
if (!SuppressImplicitRemWarnings) {
Wprint("Unrecognized command; interpreting as REM");
WarnedAboutImplicit = 1;
}
CreateParser(CurLine, &p);
r=DoCalRem(&p, col);
break;

View File

@@ -704,7 +704,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
DBufFree(&buf);
trig->typ = MSG_TYPE;
if (s->isnested) return E_CANT_NEST_RTYPE;
if (!WarnedAboutImplicit) {
if (!WarnedAboutImplicit && !SuppressImplicitRemWarnings) {
Wprint("Missing REM type; assuming MSG");
WarnedAboutImplicit = 1;
}

View File

@@ -171,6 +171,9 @@ EXTERN DynamicBuffer ExprBuf;
/* User-func recursion level */
EXTERN INIT( unsigned int FuncRecursionLevel, 0);
/* Suppress warnings about implicit REM and MSG */
EXTERN INIT( int SuppressImplicitRemWarnings, 0);
extern int NumFullOmits, NumPartialOmits;
/* List of months */

View File

@@ -356,8 +356,10 @@ static void DoReminders(void)
/* If we don't recognize the command, do a REM by default, but warn */
default:
Wprint("Unrecognized command; interpreting as REM");
WarnedAboutImplicit = 1;
if (!SuppressImplicitRemWarnings) {
Wprint("Unrecognized command; interpreting as REM");
WarnedAboutImplicit = 1;
}
DestroyParser(&p);
CreateParser(CurLine, &p);
purge_handled = 1;

View File

@@ -934,6 +934,7 @@ static SysVar SysVarArr[] = {
{"SortByTime", 0, INT_TYPE, &SortByTime, 0, 0 },
{"SubsIndent", 1, INT_TYPE, &SubsIndent, 0, 132 },
{"Sunday", 1, STR_TYPE, &DynamicDayName[6], 0, 0 },
{"SuppressImplicitWarnings", 1, INT_TYPE, &SuppressImplicitRemWarnings, 0, 1},
{"SuppressLRM", 1, INT_TYPE, &SuppressLRM, 0, 1 },
{"SysInclude", 0, STR_TYPE, &SysDir, 0, 0 },
{"T", 0, SPECIAL_TYPE, trig_date_func, 0, 0 },

View File

@@ -2799,6 +2799,7 @@ $ParseUntriggered 1 [0, 1]
$SortByTime 0
$SubsIndent 0 [0, 132]
$Sunday "Sunday"
$SuppressImplicitWarnings 0 [0, 1]
$SuppressLRM 0 [0, 1]
$T 0
$Td -1
@@ -13555,6 +13556,7 @@ $SortByPrio
$SortByTime
$SubsIndent
$Sunday
$SuppressImplicitWarnings
$SuppressLRM
$SysInclude
$T