[Remind-Fans] am_pm (was Re: Determining if -@ was passed?)

Tim Chase remind at tim.thechases.com
Sun Oct 9 18:23:59 EDT 2022


Dianne Skoll wrote:
> Tim Chase wrote:
>> The only gotcha I've encountered in using that function is that the
>> non-printing ANSI sequence gets considered as part of the string
>> length when using MSF
> 
> Yep.  MSF is broken with respect to non-printing sequences and also,
> as it turns out, with multibyte UTF-8 characters.  I'm not sure how
> widely MSF is used, so this may not be fixed for a while.

I tend to use MSF in cases where my description is lengthier prose like

 REM Oct 10 2022 MSF %"Jan's party%" celebrating 20 years \
    with the company, and promotion to VP. \
    Bring drinks and snacks.

whereas I turn to manually inserting %_ linebreaks when there's
logical breaks in the reminder

 REM Oct 10 2022 MSG %"Flight to DC%"%_\
    Flight 1414%_\
    Depart DFW 10:18 (CST)%_\
    Arrive BWI 13:02 (EST)%_\
    Hotel: Chez Americana%_\
      2600 Pennsylvania Avenue%_\
    Hertz reservation #314159265

I was going to mention that there was a hiccup with MSF and %_
getting eaten as part of the reflowing, but a test just now shows
that's no longer the case, so I might be using MSF even more now.
Thanks for fixing that!

>>   FSET am_pm(tm) IIF(\
>>     tm<01:00, tm+12*60+"am", \
>>     tm<12:00, tm+"am", \
>>     tm<13:00, tm+"pm", \
>>     tm-12*60+"pm")
>
> Any reason you don't use the built-in "ampm" function for this?

My use of it predates the availability of the function.  A `git
blame` shows it went in right about the start of the pandemic
(Feb/Mar of 2020), and for a long time, the FreeBSD repos had a
notably older version.  So yes, now that I'm aware it's there (and
non-antediluvian versions in FreeBSD's repo), I've stripped out my
custom version and switched over to the built-in.  Nice to have
less to maintain in my helpers.rem file. :-)

>> Any chance for a format-string character that prints the
>> AT-to-DURATION time range?  I've created a custom function to do it
>> for me:
> 
> You can override a substitution sequence.  For example, if you find you
> never use "%7" in your files, you can simply redefine it:
> 
> FSET subst_7(a, d, t) timespan()
> 
> and "%7" will now magically be equivalent to [timespan()]
> See RUN-TIME MODIFICATION OF THE SUBSTITUTION FILTER in the Remind man
> page.

Wait, what?  WHAT?!  You've been busy.  Somehow this slipped my
notice when it went in earlier this year.  Wowzer, this is fantastic!

*does a happy dance*

So many use cases for this bouncing around in my head now.

While throwing wish ideas out there, any chance for a trigtag()
function to access the tag(s) associated with a reminder?

Thanks again for all you do with Remind!

-a very giddy Tim








More information about the Remind-fans mailing list