[Remind-Fans] Determining if -@ was passed?

Tim Chase tim at thechases.com
Sun Oct 9 13:54:27 EDT 2022


On 2022-10-09 11:08, Dianne Skoll via Remind-fans wrote:
> Tim Chase via Remind-fans wrote:
> > Is there a way for a reminder file to determine of -@ was passed
> > on the command-line?
> 
> Nope.  I could fix that.

I figured it would be a pretty quick patch to add that to the
available system-variables (prob. takes more code to patch the
man-page :-)

> > and then a color function c() that converts it to the corresponding
> > ANSI sequence for the specified color-depth, letting me do things
> > like
> 
> >   REM Oct 9 2022 MSG This is [c(Purple)]Purple text[c($DefaultColor)]?
> 
> That's a pretty good idea, and should not be too hard to implement.
> I'd obviously call the function something more descriptive like "ansicolor"
> but you could always:
> 
> FSET c(x) ansicolor(x)
> 
> if you want briefer REM commands.

Indeed, I agree that, for public consumption, a more sensible name
works better.

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, so it can introduce surpise artifacts,
considering lines longer than the actual (printing) text they
contain:

SET Nrm $DefaultColor
REM MSF This is a demo of [c(Green)]green[c(Nrm)] \
  and [c(Purple)]purple[c(Nrm)] \
  and [c(Yellow)]yellow[c(Nrm)] \
  and [c(Red)]red[c(Nrm)] \
  text that is really long and triggers wrapping.
REM MSF This is a demo of green \
  and purple \
  and yellow \
  and red \
  text that is really long and triggers wrapping.

(note that they wrap differently)

> Thanks for the idea!

While tossing ideas out into the ether... ;-)

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:

  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")

  FSET timespan() am_pm(trigtime()) \
    + iif(trigduration() == -1, \
        "", \
        "-" + am_pm(trigtime() + trigduration()) \
        )

  REM Oct 10 2022 AT 11:00 DURATION 1:30 REM Meeting [timespan()]

but there are a LOT of "[timespan()]" calls in my files where it
feels like this should be the sort of thing that a format-string
would handle for me (pretending it's "%-"):

  REM Oct 10 2022 AT 11:00 DURATION 1:30 REM Meeting %-

Anyways, thanks! (and again, if you want me to take a stab at
crafting patches to do the above, I'd be glad to give it a go)

-Tim







More information about the Remind-fans mailing list