[Remind-Fans] Categorize OMIT

Tim Chase remind at tim.thechases.com
Wed Mar 1 19:50:39 EST 2023


On 2023-02-28 19:33, Dianne Skoll via Remind-fans wrote:
> Tim Chase wrote:
> 
> [Four different INCLUDE files for holidays]
> > then in my respective calendars, I can include them in PUSH/POP blocks
> 
> I think Tim's solution is the most practical.  Organizing the various
> holidays in include files makes sense.

The only issue I've found is that if a file is included multiple
times, OMITs with MSG portions show up multiple times.  E.g.

  $ grep ^ *rem .reminders
  hol_city.rem:INCLUDE hol_common.rem
  hol_city.rem:
  hol_city.rem:OMIT Mar 1 MSG City holiday
  hol_city.rem:
  hol_common.rem:OMIT Mar 3 MSG Common holiday
  hol_common.rem:
  hol_school.rem:INCLUDE hol_common.rem
  hol_school.rem:
  hol_school.rem:OMIT Mar 2 MSG School holiday
  hol_school.rem:
  .reminders:PUSH
  .reminders: INCLUDE hol_city.rem
  .reminders: REM OMIT SKIP MSG City event
  .reminders:POP
  .reminders:
  .reminders:PUSH
  .reminders: INCLUDE hol_school.rem
  .reminders: REM OMIT Sat Sun SKIP MSG School event
  .reminders:POP

  $ rem -c+
  +----------+----------+----------+----------+----------+----------+----------+
  |  Sunday  |  Monday  | Tuesday  |Wednesday | Thursday |  Friday  | Saturday |
  +----------+----------+----------+----------+----------+----------+----------+
  |26 Feb    |27 Feb    |28 Feb    |1 Mar *** |2 Mar     |3 Mar     |4 Mar     |
  |          |          |          |          |          |          |          |
  |City event|City event|City event|City      |City event|Common    |City event|
  |          |          |          |holiday   |          |holiday   |          |
  |          |School    |School    |          |School    |          |          |
  |          |event     |event     |School    |holiday   |Common    |          |
  |          |          |          |event     |          |holiday   |          |
  +----------+----------+----------+----------+----------+----------+----------+

Note the "Common holiday" shows up twice on the 3rd.

The only way I could come up with to prevent this (without repeating
the holiday logic; not a problem with easier holidays, but a bit
of a pain for more complex holiday calculations) was to use variables,
something like

  # hol_common.rem
  # null REM statements to identify dates
  # as one would normally find holidays
  REM Dec 25 SATISFY 1
  # preserve it as a variable
  SET holChristmas $T
  # OMIT it with no message to get repeated
  OMIT [$T]

  REM Fourth Thu Nov SATISFY 1
  SET holThanksgiving $T
  OMIT [$T]

  IF !defined("holShown")
    SET holShown 1
    REM [holChristmas] MSG Christmas
    REM [holThanksgiving] MSG Thanksgiving
  ENDIF

If there's some better way to do this, I'd love to simplify that. :-)

-tim







More information about the Remind-fans mailing list