[Remind-Fans] Unnecessary "baggage" in Labor Day reminder in holidays.rem?

Dianne Skoll dianne at skoll.ca
Wed Sep 8 13:32:27 EDT 2021


On Wed, 8 Sep 2021 12:24:43 -0400
Jonathan Kamens via Remind-fans <remind-fans at lists.skoll.ca> wrote:

> My holidays.rem which I snarfed from somewhere semi-official long,
> long ago has this in it:
> 
> SET  Week_1              1
> ...
> FSET _back(days)        TRIGGER(TODAY()-days)
> FSET _trig()            TRIGGER(TRIGDATE())
> ...
> REM  Mon Sep [Week_1]   SCANFROM [_back(7)] SATISFY 1
> OMIT [_trig()] MSG %"Labor Day%"%


[...]

> So does this even simpler version [calculate Labor Day Correctly]

> REM  Mon Sep 1 MSG %"Labor Day%"%

The simpler version is fine if you don't want to OMIT labor day.
The reason for the baroque mechanism is as follows.  Consider this
Reminder file example.rem:

         REM Mon Sep 1 MSG Labor Day
         OMIT [trigdate()]
         REM 6 Sep AFTER MSG Something

Let's run it through "remind -dtxe example.rem 7 Sep 2021"

         REM Mon Sep 1 MSG Labor Day
         example.rem(1): Trig = Monday, 5 September, 2022
         OMIT [trigdate()]
         trigdate() => 2022-09-05
         REM 6 Sep AFTER MSG Something
         example.rem(3): Trig = Tuesday, 6 September, 2022

As you see, running it the day after Labor Day made Remind find *next year's*
labor day and OMIT that one.  The "Something" reminder should have triggered
on 7 Sep, but didn't because 6 Sep was not OMITted.

Now let's try this one:

         REM Mon Sep 1 SCANFROM [today()-7] MSG Labor Day
         OMIT [trigdate()]
         REM 6 Sep AFTER MSG Something

$ remind -dtxe example.rem 7 Sep 2021
         REM Mon Sep 1 SCANFROM [today()-7] MSG Labor Day
         today() => 2021-09-07
         2021-09-07 - 7 => 2021-08-31
         example.rem(1): Trig = Monday, 6 September, 2021
         OMIT [trigdate()]
         trigdate() => 2021-09-06
         REM 6 Sep AFTER MSG Something
         example.rem(3): Trig = Tuesday, 7 September, 2021
         Reminders for Tuesday, 7th September, 2021:

         Something

Notice how we found *this* year's Labor Day, which was correctly
OMITted, causing the reminder on line 3 to trigger.

> Why do I care? Because, separately, I have something in my own
> reminders to show me candle-lighting time for the first night of Rosh
> Hashanah:

[...]

> It malfunctioned this year and didn't put the candle-lighting time on
> my calendar, I think because Erev Rosh Hashanah was Labor Day and
> therefore the SKIP my rule caused the reminder to be omitted because
> of the OMIT [_trig()] in the Labor Day rule.

Yep. If you have a SKIP that you don't want affected by global OMITs,
you can do this:

        PUSH-OMIT-CONTEXT
        CLEAR-OMIT-CONTEXT
        # Here goes your REM that is sensitive to OMIT context
        POP-OMIT-CONTEXT

Regards,

Dianne.


More information about the Remind-fans mailing list