mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Add the $Shaded system variable.
This commit is contained in:
@@ -147,7 +147,7 @@
|
||||
"$May" "$MinsFromUTC" "$Minute" "$Monday" "$Mplu" "$NextMode"
|
||||
"$November" "$Now" "$NumFullOmits" "$NumPartialOmits" "$NumQueued"
|
||||
"$NumTrig" "$October" "$On" "$OnceFile" "$ParseUntriggered" "$Pm"
|
||||
"$PrefixLineNo" "$PSCal" "$RunOff" "$Saturday" "$September"
|
||||
"$PrefixLineNo" "$PSCal" "$RunOff" "$Saturday" "$September" "$Shaded"
|
||||
"$SimpleCal" "$SortByDate" "$SortByPrio" "$SortByTime" "$SubsIndent"
|
||||
"$Sunday" "$SuppressImplicitWarnings" "$SuppressLRM" "$SysInclude" "$T" "$Tb" "$Td"
|
||||
"$TerminalBackground" "$TerminalHyperlinks" "$Thursday" "$TimeSep" "$TimetIs64bit" "$Tm" "$Today" "$TodoFilter"
|
||||
|
||||
@@ -3361,6 +3361,30 @@ If non-zero, then the \fB\-p\fR option was supplied on the command line.
|
||||
.B $RunOff (read-only)
|
||||
If non-zero, the \fBRUN\fR directives are disabled.
|
||||
.TP
|
||||
.B $Shaded (read-only)
|
||||
Returns the number of times a \fBSHADE\fR special reminder has triggered.
|
||||
\fIThis variable is set only in calendar mode, not agenda mode\fR. You
|
||||
can use this variable to avoid shading a calendar day that has already
|
||||
been shaded.
|
||||
.RS
|
||||
.PP
|
||||
For example, suppose you want to shade all calendar boxes yellow
|
||||
\fIif\fR any reminders have triggered on that day. But if a box has
|
||||
been explicitly shaded, you don't want to overwrite that shading.
|
||||
You could use something like this:
|
||||
.PP
|
||||
.nf
|
||||
SET n $NumTrig
|
||||
# Do all your reminders here...
|
||||
|
||||
# If anything has triggered and the box is
|
||||
# not already shaded, then shade it yellow
|
||||
IF $NumTrig > n && !$Shaded
|
||||
REM SPECIAL SHADE 255 255 128
|
||||
ENDIF
|
||||
.fi
|
||||
.RE
|
||||
.TP
|
||||
.B $SimpleCal (read-only)
|
||||
Set to a non-zero value if \fIeither\fR of the \fB\-p\fR or \fB\-s\fR
|
||||
command-line options was supplied.
|
||||
|
||||
@@ -2123,8 +2123,9 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
}
|
||||
}
|
||||
if (trig.typ == PASSTHRU_TYPE) {
|
||||
if (!PsCal && !strcasecmp(trig.passthru, "SHADE")) {
|
||||
if (dse == DSEToday) {
|
||||
if (!strcasecmp(trig.passthru, "SHADE") && dse == DSEToday) {
|
||||
Shaded++;
|
||||
if (!PsCal) {
|
||||
DBufInit(&obuf);
|
||||
r = DoSubst(p, &obuf, &trig, &tim, dse, CAL_MODE);
|
||||
if (r) {
|
||||
|
||||
@@ -106,6 +106,7 @@ EXTERN INIT( int DefaultPrio, NO_PRIORITY);
|
||||
EXTERN INIT( int SysTime, -1);
|
||||
EXTERN INIT( int LocalSysTime, -1);
|
||||
EXTERN INIT( int ParseUntriggered, 0);
|
||||
EXTERN INIT( int Shaded, 0);
|
||||
|
||||
EXTERN char const *InitialFile;
|
||||
EXTERN char const *LocalTimeZone;
|
||||
|
||||
@@ -295,6 +295,7 @@ PerIterationInit(void)
|
||||
DefaultColorG = -1;
|
||||
DefaultColorB = -1;
|
||||
NumTriggered = 0;
|
||||
Shaded = 0;
|
||||
JSONLinesEmitted = 0;
|
||||
ClearLastTriggers();
|
||||
ClearDedupeTable();
|
||||
|
||||
@@ -1101,6 +1101,7 @@ static SysVar SysVarArr[] = {
|
||||
{"RunOff", 0, INT_TYPE, &RunDisabled, 0, 0 },
|
||||
{"Saturday", 1, TRANS_TYPE, "Saturday", 0, 0 },
|
||||
{"September", 1, TRANS_TYPE, "September", 0, 0 },
|
||||
{"Shaded" , 0, INT_TYPE, &Shaded, 0, 0 },
|
||||
{"SimpleCal", 0, INT_TYPE, &DoSimpleCalendar, 0, 0 },
|
||||
{"SortByDate", 0, INT_TYPE, &SortByDate, 0, 0 },
|
||||
{"SortByPrio", 0, INT_TYPE, &SortByPrio, 0, 0 },
|
||||
|
||||
15
tests/shaded.rem
Normal file
15
tests/shaded.rem
Normal file
@@ -0,0 +1,15 @@
|
||||
REM Wed SPECIAL SHADE 255 0 0
|
||||
IF !$Shaded
|
||||
REM 15 SPECIAL SHADE 0 255 0
|
||||
ENDIF
|
||||
IF !$Shaded
|
||||
REM SATISFY [$Td % 4 == 0] SPECIAL SHADE 0 0 255
|
||||
ENDIF
|
||||
|
||||
IF !$Shaded
|
||||
REM Sunday SPECIAL SHADE 0 255 255
|
||||
ENDIF
|
||||
|
||||
IF !$Shaded
|
||||
REM SPECIAL SHADE 255 255 0
|
||||
ENDIF
|
||||
@@ -987,6 +987,9 @@ REM 15 INFO "Url: https://dianne.skoll.ca" CAL Hello, linky 3!
|
||||
REM 15 INFO "Url: https://dianne.skoll.ca" SPECIAL COLOR 255 0 0 Hello, linky 4!
|
||||
EOF
|
||||
|
||||
# Test the $Shaded system variable
|
||||
$REMIND -pp ../tests/shaded.rem >> $OUT 2>&1
|
||||
|
||||
cmp -s $OUT $CMP
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Remind: Acceptance tests ${GRN}PASSED${NRM}"
|
||||
|
||||
@@ -24951,6 +24951,7 @@ $PSCal
|
||||
$RunOff
|
||||
$Saturday
|
||||
$September
|
||||
$Shaded
|
||||
$SimpleCal
|
||||
$SortByDate
|
||||
$SortByPrio
|
||||
@@ -40236,4 +40237,39 @@ February 28
|
||||
+----------+----------+----------+----------+----------+----------+----------+
|
||||
|26 |27 |28 |29 |30 |31 | |
|
||||
+----------+----------+----------+----------+----------+----------+----------+
|
||||
|
||||
# translations
|
||||
{"LANGID":"en"}
|
||||
# rem2ps2 begin
|
||||
February 2026 28 0 0
|
||||
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
|
||||
January 31
|
||||
March 31
|
||||
{"date":"2026-02-01","filename":"../tests/shaded.rem","lineno":10,"passthru":"SHADE","wd":["Sunday"],"is_todo":0,"priority":5000,"if_depth":1,"r":0,"g":255,"b":255,"body":"0 255 255"}
|
||||
{"date":"2026-02-02","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-03","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-04","filename":"../tests/shaded.rem","lineno":1,"passthru":"SHADE","wd":["Wednesday"],"is_todo":0,"priority":5000,"r":255,"g":0,"b":0,"body":"255 0 0"}
|
||||
{"date":"2026-02-05","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-06","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-07","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-08","filename":"../tests/shaded.rem","lineno":6,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":0,"g":0,"b":255,"body":"0 0 255"}
|
||||
{"date":"2026-02-09","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-10","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-11","filename":"../tests/shaded.rem","lineno":1,"passthru":"SHADE","wd":["Wednesday"],"is_todo":0,"priority":5000,"r":255,"g":0,"b":0,"body":"255 0 0"}
|
||||
{"date":"2026-02-12","filename":"../tests/shaded.rem","lineno":6,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":0,"g":0,"b":255,"body":"0 0 255"}
|
||||
{"date":"2026-02-13","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-14","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-15","filename":"../tests/shaded.rem","lineno":3,"passthru":"SHADE","d":15,"is_todo":0,"priority":5000,"if_depth":1,"r":0,"g":255,"b":0,"body":"0 255 0"}
|
||||
{"date":"2026-02-16","filename":"../tests/shaded.rem","lineno":6,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":0,"g":0,"b":255,"body":"0 0 255"}
|
||||
{"date":"2026-02-17","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-18","filename":"../tests/shaded.rem","lineno":1,"passthru":"SHADE","wd":["Wednesday"],"is_todo":0,"priority":5000,"r":255,"g":0,"b":0,"body":"255 0 0"}
|
||||
{"date":"2026-02-19","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-20","filename":"../tests/shaded.rem","lineno":6,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":0,"g":0,"b":255,"body":"0 0 255"}
|
||||
{"date":"2026-02-21","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-22","filename":"../tests/shaded.rem","lineno":10,"passthru":"SHADE","wd":["Sunday"],"is_todo":0,"priority":5000,"if_depth":1,"r":0,"g":255,"b":255,"body":"0 255 255"}
|
||||
{"date":"2026-02-23","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-24","filename":"../tests/shaded.rem","lineno":6,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":0,"g":0,"b":255,"body":"0 0 255"}
|
||||
{"date":"2026-02-25","filename":"../tests/shaded.rem","lineno":1,"passthru":"SHADE","wd":["Wednesday"],"is_todo":0,"priority":5000,"r":255,"g":0,"b":0,"body":"255 0 0"}
|
||||
{"date":"2026-02-26","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-27","filename":"../tests/shaded.rem","lineno":14,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":255,"g":255,"b":0,"body":"255 255 0"}
|
||||
{"date":"2026-02-28","filename":"../tests/shaded.rem","lineno":6,"passthru":"SHADE","is_todo":0,"priority":5000,"if_depth":1,"r":0,"g":0,"b":255,"body":"0 0 255"}
|
||||
# rem2ps2 end
|
||||
|
||||
Reference in New Issue
Block a user