diff --git a/src/calendar.c b/src/calendar.c index be450820..1978fb24 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -1325,6 +1325,9 @@ static int DoCalRem(ParsePtr p, int col) if (trig.typ == SAT_TYPE) { r=DoSatRemind(&trig, &tim, p); if (r) { + if (r == E_CANT_TRIG && trig.maybe_uncomputable) { + r = OK; + } FreeTrig(&trig); if (r == E_EXPIRED) return OK; return r; @@ -1369,6 +1372,9 @@ static int DoCalRem(ParsePtr p, int col) /* Calculate the trigger date */ jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1); if (r) { + if (r == E_CANT_TRIG && trig.maybe_uncomputable) { + r = OK; + } FreeTrig(&trig); return r; } diff --git a/src/dorem.c b/src/dorem.c index db78dec5..ef91f366 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -81,6 +81,9 @@ int DoRem(ParsePtr p) PurgeEchoLine("%s\n", CurLine); r=DoSatRemind(&trig, &tim, p); if (r) { + if (r == E_CANT_TRIG && trig.maybe_uncomputable) { + r = OK; + } FreeTrig(&trig); if (r == E_EXPIRED) return OK; return r; @@ -134,6 +137,9 @@ int DoRem(ParsePtr p) PurgeEchoLine("%s: %s\n", "#!P! Problem calculating trigger date", ErrMsg[r]); PurgeEchoLine("%s\n", CurLine); } + if (r == E_CANT_TRIG && trig.maybe_uncomputable) { + r = OK; + } FreeTrig(&trig); return r; } @@ -219,6 +225,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals) trig->duration_days = 0; trig->eventstart = NO_TIME; trig->eventduration = NO_TIME; + trig->maybe_uncomputable = 0; DBufInit(&(trig->tags)); trig->passthru[0] = 0; tim->ttime = NO_TIME; @@ -276,6 +283,10 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals) trig->m = tok.val; break; + case T_MaybeUncomputable: + trig->maybe_uncomputable = 1; + break; + case T_Skip: DBufFree(&buf); if (trig->skip != NO_SKIP) return E_SKIP_ERR; diff --git a/src/funcs.c b/src/funcs.c index 57560ace..b46db939 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -2917,6 +2917,10 @@ FEvalTrig(func_info *info) } jul = ComputeTrigger(scanfrom, &trig, &tim, &r, 0); } + if (r == E_CANT_TRIG && trig.maybe_uncomputable) { + r = 0; + jul = -1; + } FreeTrig(&trig); if (r) return r; if (jul < 0) { diff --git a/src/main.c b/src/main.c index 2548b2a6..0da08f1a 100644 --- a/src/main.c +++ b/src/main.c @@ -813,9 +813,11 @@ int DoIfTrig(ParsePtr p) if (trig.typ != NO_TYPE) return E_PARSE_ERR; jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1); if (r) { - if (!Hush || r != E_RUN_DISABLED) { - Eprint("%s", ErrMsg[r]); - } + if (r != E_CANT_TRIG || !trig.maybe_uncomputable) { + if (!Hush || r != E_RUN_DISABLED) { + Eprint("%s", ErrMsg[r]); + } + } syndrome = IF_TRUE | BEFORE_ELSE; } else { diff --git a/src/token.c b/src/token.c index c6ef4191..afc9a122 100644 --- a/src/token.c +++ b/src/token.c @@ -67,6 +67,7 @@ Token TokArray[] = { { "june", 3, T_Month, 5 }, { "march", 3, T_Month, 2 }, { "may", 3, T_Month, 4 }, + { "maybe-uncomputable", 5, T_MaybeUncomputable, 0}, { "monday", 3, T_WkDay, 0 }, { "msf", 3, T_RemType, MSF_TYPE }, { "msg", 3, T_RemType, MSG_TYPE }, diff --git a/src/types.h b/src/types.h index 1e92e357..6333a8e2 100644 --- a/src/types.h +++ b/src/types.h @@ -73,6 +73,7 @@ typedef struct { int duration_days; /* Duration converted to days to search */ int eventstart; /* Original event start (datetime) */ int eventduration; /* Original event duration (minutes) */ + int maybe_uncomputable; /* Suppress "can't compute trigger" warnings */ char sched[VAR_NAME_LEN+1]; /* Scheduling function */ char warn[VAR_NAME_LEN+1]; /* Warning function */ char omitfunc[VAR_NAME_LEN+1]; /* OMITFUNC function */ @@ -171,7 +172,8 @@ enum TokTypes T_Duration, T_LongTime, T_OmitFunc, - T_Through + T_Through, + T_MaybeUncomputable }; /* The structure of a token */