[Remind-Fans] Strange interaction with sorting/-g, MSF, and {*n}

Tim Chase remind at tim.thechases.com
Thu Feb 2 14:38:35 EST 2023


I've been encountering some sorting weirdness and I'm not sure how
to track it down.  There seems to be some interaction between the
-g parameter to sort, the use of BANNER/sortbanner(), and MSF.

This fairly minimal reminder file seems to sufficiently reproduce
it for me:

  SET banner_str "%w, %m %d%s, %y%o:%"
  IF defined("iteration")
      SET banner_str "=====================%_" + banner_str
      set iteration iteration + 1
      preserve iteration
  ELSE
      set iteration 1
      preserve iteration
  ENDIF

  # if we're doing any sorting:
  IF $SortByDate + $SortByPrio + $SortByTime > 0
      # don't use the default banner
      BANNER %
      FSET sortbanner(x) iif(x == today(), \
          banner_str, \
          "----%c %b----%" \
          )
  ELSE
      BANNER [banner_str]
  ENDIF
  REM Feb 2 2023 MSG An event today%
  REM Feb 3 2023 AT 7:30am DURATION 1:30 MSG Troublesome event tomorrow%
  REM FEb 3 2023 MSG Unformatted event%

works as expected

  $ rem -g '*2'
  Thursday, February 2nd, 2023 (today):
  An event today
  =====================
  Friday, February 3rd, 2023:
  Troublesome event tomorrow
  Unformatted event

But if I change that Troublesome event from MSG to a MSF

  $ sed -i.bak '/Troublesome/s/MSG/MSF/' ~/.reminders

Issuing the same command puts the Troublesome event *above* my
banner:

  $ rem -g '*2'
  Thursday, February 2nd, 2023 (today):
  An event today
  Troublesome event tomorrow
  =====================
  Friday, February 3rd, 2023:
  Unformatted event

If I have the MSF but don't sort them with `-g`, it also seems to
work:

  $ rem '*2'
  Thursday, February 2nd, 2023 (today):
  An event today
  =====================
  Friday, February 3rd, 2023:
  Troublesome event tomorrow
  Unformatted event

My goal was to have the first event get the desired (more verbose)
banner, and then on subsequent events (triggered by the "*2" on the
command-line), use a terser banner if things get sorted.

But I'm mystified why MSF seems to trigger this odd sorting behavior.

Any insights?

Thanks!

-tim

(FWIW, running 04.02.02 on FreeBSD 13.1)







More information about the Remind-fans mailing list