mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 14:59:20 +02:00
Only check the trigger portion of a REM for expressions in purge mode, not body.
This commit is contained in:
@@ -546,7 +546,7 @@ int DoRem(ParsePtr p)
|
||||
}
|
||||
if (PurgeMode) {
|
||||
if (trig.expired || (!trig.is_todo && dse < DSEToday)) {
|
||||
if (p->expr_happened) {
|
||||
if (trig.expr_happened) {
|
||||
if (trig.nonconst_expr) {
|
||||
if (!Hush) {
|
||||
PurgeEchoLine("%s\n", "#!P: Next line may have expired, but contains non-constant expression");
|
||||
@@ -834,6 +834,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
trig->infos = NULL;
|
||||
trig->tz = NULL;
|
||||
trig->nonconst_expr = 0;
|
||||
trig->expr_happened = 0;
|
||||
|
||||
int parsing = 1;
|
||||
while(parsing) {
|
||||
@@ -1206,6 +1207,9 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
if (s->nonconst_expr) {
|
||||
trig->nonconst_expr = 1;
|
||||
}
|
||||
if (s->expr_happened) {
|
||||
trig->expr_happened = 1;
|
||||
}
|
||||
if (trig->need_wkday && trig->wd == NO_WD) {
|
||||
Eprint("Weekday name(s) required");
|
||||
return E_PARSE_ERR;
|
||||
|
||||
@@ -143,11 +143,13 @@ typedef struct {
|
||||
int eventstart; /* Original event start (datetime) */
|
||||
int eventstart_orig; /* Original event start in TZ (datetime) */
|
||||
int eventduration; /* Original event duration (minutes) */
|
||||
int maybe_uncomputable; /* Suppress "can't compute trigger" warnings */
|
||||
int addomit; /* Add trigger date to global OMITs */
|
||||
int noqueue; /* Don't queue even if timed */
|
||||
int nonconst_expr; /* Non-constant expression encountered */
|
||||
int max_overdue; /* Stop warning if TODO is too far overdue */
|
||||
unsigned char addomit; /* Add trigger date to global OMITs */
|
||||
unsigned char maybe_uncomputable; /* Suppress "can't compute trigger" warnings */
|
||||
unsigned char nonconst_expr; /* Non-constant expression encountered */
|
||||
unsigned char expr_happened;
|
||||
|
||||
char sched[VAR_NAME_LEN+1]; /* Scheduling function */
|
||||
char warn[VAR_NAME_LEN+1]; /* Warning function */
|
||||
char omitfunc[VAR_NAME_LEN+1]; /* OMITFUNC function */
|
||||
|
||||
@@ -926,6 +926,19 @@ REM 2025 Oct [a] MSG Nonconst IS set [today()]
|
||||
REM 2025 Oct [a] MSG Nonconst IS set
|
||||
EOF
|
||||
|
||||
$REMIND -j - 2025-12-31 <<'EOF' >> $OUT 2>&1
|
||||
# Nonconst-expr in trigger
|
||||
set $ParseUntriggered 1
|
||||
set a (today()+1)-today()
|
||||
REM 2025-10-01 MSG Nonconst NOT set [today()]
|
||||
REM 2025 Oct [a] MSG Nonconst IS set [today()]
|
||||
REM 2025 Oct [a] MSG Nonconst IS set
|
||||
REM 2025 Oct [1] MSG Expr but not nonconst [today()]
|
||||
REM 2025-10-01 MSG No expr seen [1+2]
|
||||
EOF
|
||||
|
||||
# Purge mode
|
||||
|
||||
cmp -s $OUT $CMP
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Remind: Acceptance tests ${GRN}PASSED${NRM}"
|
||||
|
||||
@@ -39931,3 +39931,16 @@ No reminders.
|
||||
{"date":"2025-10-01","filename":"-stdin-","lineno":4,"nonconst_expr":1,"d":1,"m":10,"y":2025,"is_todo":0,"trigbase":"2025-10-1 ","priority":5000,"body":"Nonconst IS set 2025-10-01"},
|
||||
{"date":"2025-10-01","filename":"-stdin-","lineno":5,"nonconst_expr":1,"d":1,"m":10,"y":2025,"is_todo":0,"trigbase":"2025-10-1 ","priority":5000,"body":"Nonconst IS set"}
|
||||
]
|
||||
# Nonconst-expr in trigger
|
||||
set $ParseUntriggered 1
|
||||
set a (today()+1)-today()
|
||||
#!P: Expired: REM 2025-10-01 MSG Nonconst NOT set [today()]
|
||||
#!P: Next line may have expired, but contains non-constant expression
|
||||
#!P: or a relative SCANFROM clause
|
||||
REM 2025 Oct [a] MSG Nonconst IS set [today()]
|
||||
#!P: Next line may have expired, but contains non-constant expression
|
||||
#!P: or a relative SCANFROM clause
|
||||
REM 2025 Oct [a] MSG Nonconst IS set
|
||||
#!P: Next line has expired, but contains expression... please verify
|
||||
#!P: Expired: REM 2025 Oct [1] MSG Expr but not nonconst [today()]
|
||||
#!P: Expired: REM 2025-10-01 MSG No expr seen [1+2]
|
||||
|
||||
Reference in New Issue
Block a user