From ee1c93193235948ca3227e532fc6da0b0646a40e Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Sun, 15 Sep 2024 09:39:15 -0400 Subject: [PATCH] Add $SuppressImplicitWarnings system variable. This suppresses warnings about missing REM or MSG tokens. --- contrib/remind-conf-mode/remind-conf-mode.el | 2 +- man/remind.1.in | 9 ++++++++- src/calendar.c | 6 ++++-- src/dorem.c | 2 +- src/globals.h | 3 +++ src/main.c | 6 ++++-- src/var.c | 1 + tests/test.cmp | 2 ++ 8 files changed, 24 insertions(+), 7 deletions(-) diff --git a/contrib/remind-conf-mode/remind-conf-mode.el b/contrib/remind-conf-mode/remind-conf-mode.el index 20d42d39..913d38e4 100644 --- a/contrib/remind-conf-mode/remind-conf-mode.el +++ b/contrib/remind-conf-mode/remind-conf-mode.el @@ -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" diff --git a/man/remind.1.in b/man/remind.1.in index 03b4e669..134d7e09 100644 --- a/man/remind.1.in +++ b/man/remind.1.in @@ -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 diff --git a/src/calendar.c b/src/calendar.c index 9a13b0f2..4a04da66 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -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; diff --git a/src/dorem.c b/src/dorem.c index a6f219d0..2f1b6c7a 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -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; } diff --git a/src/globals.h b/src/globals.h index ef96a812..2e58c8d4 100644 --- a/src/globals.h +++ b/src/globals.h @@ -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 */ diff --git a/src/main.c b/src/main.c index bfd40ed6..42775dae 100644 --- a/src/main.c +++ b/src/main.c @@ -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; diff --git a/src/var.c b/src/var.c index 7d51414e..31912435 100644 --- a/src/var.c +++ b/src/var.c @@ -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 }, diff --git a/tests/test.cmp b/tests/test.cmp index 806647bb..8348b174 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -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