[Remind-Fans] Unnecessary "baggage" in Labor Day reminder in holidays.rem?
Jonathan Kamens
jik at kamens.us
Wed Sep 8 22:49:35 EDT 2021
Digging into this a bit further, I think there's some additional context
I was missing before. Sharing this in case it is helpful to other people...
In my first examination of these two commands, I thought they were a
single REM command, but they aren't, they're actually two separate
commands. Note that there's no backslash at the end of the first line:
REM Mon Sep [Week_1] SCANFROM [_back(7)] SATISFY 1
OMIT [_trig()] MSG %"Labor Day%"%
So the purpose of the first line above is to calculate the correct date
for Labor Day so that the second command above can retrieve that date
using trigdate(). The second command, the OMIT, is doing double-duty as
both a global omit and a reminder. From the man page: "For convenience,
you can use a delta and MSG or RUN keyword in the OMIT command."
Since I didn't initially realize that the two commands above were
separate commands, I didn't realize that the second one was establishing
a global omit, so I didn't understand why the Labor Day code was
affecting my Rosh Hashanah candle-lighting code. Dianne's explanation
about global omits prompted me to dig deeper and understand better.
Thanks for the explanation, Dianne.
jik
On 9/8/21 1:32 PM, Dianne Skoll via Remind-fans wrote:
> 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.
> _______________________________________________
> Remind-fans mailing list
> Remind-fans at lists.skoll.ca
> https://dianne.skoll.ca/mailman/listinfo/remind-fans
> Remind is at https://dianne.skoll.ca/projects/remind/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://dianne.skoll.ca/pipermail/remind-fans/attachments/20210908/51810994/attachment.htm>
More information about the Remind-fans
mailing list