mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 23:08:40 +02:00
Compare commits
5 Commits
6bdee7ef89
...
ed38feee83
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed38feee83 | ||
|
|
d7f5582a45 | ||
|
|
d042263d3d | ||
|
|
f1591140d4 | ||
|
|
1b41367163 |
@@ -128,9 +128,10 @@
|
||||
|
||||
(defconst remind-builtin-variables
|
||||
(sort
|
||||
(list "$AddBlankLines" "$Ago" "$Am" "$And" "$April" "$At" "$August"
|
||||
(list " $AddBlankLines" "$Ago" "$Am" "$And" "$April" "$At" "$August"
|
||||
"$CalcUTC" "$CalMode" "$Daemon" "$DateSep" "$DateTimeSep" "$December"
|
||||
"$DedupeReminders" "$DefaultColor" "$DefaultPrio" "$DefaultTDelta" "$DeltaOverride"
|
||||
"$DedupeReminders" "$DefaultColor" "$DefaultDelta"
|
||||
"$DefaultPrio" "$DefaultTDelta" "$DeltaOverride"
|
||||
"$DontFork" "$DontQueue" "$DontTrigAts" "$EndSent" "$EndSentIg"
|
||||
"$ExpressionTimeLimit" "$February" "$FirstIndent" "$FoldYear"
|
||||
"$FormWidth" "$Friday" "$Fromnow" "$Hour" "$Hplu" "$HushMode"
|
||||
|
||||
@@ -29,3 +29,34 @@ chinese-new-year.rem - Chinese New Year from 2022 through 2050
|
||||
discordian.rem - Discordian holidays
|
||||
jewish.rem - Jewish holidays
|
||||
pagan.rem - Pagan holidays
|
||||
|
||||
ADVANCE WARNING:
|
||||
================
|
||||
|
||||
None of the included holiday files have deltas or substitution sequences.
|
||||
You can use the following trick if you would like (for example) 7 days'
|
||||
advance warning of holidays:
|
||||
|
||||
# Save old definition (if any) of msgsuffix
|
||||
FRENAME msgsuffix saved_msgsuffix
|
||||
|
||||
# Save old value of $DefaultDelta
|
||||
SET old_delta $DefaultDelta
|
||||
|
||||
# We want 7 days' advance warning
|
||||
SET $DefaultDelta 7
|
||||
|
||||
# Add a suffix to print " is in xxx days", etc.
|
||||
# Note the char(8) at the start to put the suffix
|
||||
# on the same line as the reminder, and the final %
|
||||
# in the argument of dosubst() to avoid an *extra*
|
||||
# newline from being added
|
||||
FSET msgsuffix(x) char(8) + dosubst(" is %b.%", $T)
|
||||
|
||||
# Include your holiday files here...
|
||||
INCLUDE [$SysInclude]/holidays/us.rem
|
||||
INCLUDE [$SysInclude]/holidays/us/ny.rem
|
||||
|
||||
# Restore old version of msgsuffix and $DefaultDelta
|
||||
FRENAME saved_msgsuffix msgsuffix
|
||||
SET $DefaultDelta old_delta
|
||||
|
||||
@@ -2593,6 +2593,12 @@ blocks of reminders without having to type priorities for individual
|
||||
reminders. At startup, \fB$DefaultPrio\fR is set to 5000; it can range
|
||||
from 0 to 9999.
|
||||
.TP
|
||||
.B $DefaultDelta
|
||||
You can set this variable to a number from 0 through 10000. If set to
|
||||
a non-zero number, then \fBRemind\fR triggers any \fBREM\fR statement
|
||||
that lacks a delta as if it had a delta of \fB++$DefaultDelta\fR.
|
||||
By default, \fB$DefaultDelta\fR is zero.
|
||||
.TP
|
||||
.B $DefaultTDelta
|
||||
The default time delta used if no +N is given in an AT clause. This
|
||||
is normally 0, but can be set with the \fB\-tt\fR option or explicitly
|
||||
@@ -4657,6 +4663,35 @@ or thirdfunc will exist. \fBRemind\fR does not issue an error if you
|
||||
try to \fBFUNSET\fR a nonexistent user-defined function; it simply
|
||||
does nothing in that case.
|
||||
.PP
|
||||
You can rename a user-defined function with \fBFRENAME\fR. This takes
|
||||
two names: An old name and a new name. Consider this command:
|
||||
.PP
|
||||
.nf
|
||||
FRENAME func_a func_b
|
||||
.fi
|
||||
.PP
|
||||
If \fIfunc_a\fR does not exist, the command unsets \fIfunc_b\fR if
|
||||
it is defined. However, if \fIfunc_a\fR exists, then it is renamed to
|
||||
\fIfunc_b\fR, and \fIfunc_a\fR is no longer defined. If \fIfunc_b\fR
|
||||
was defined prior to the \fBFRENAME\fR command, then that old
|
||||
definition is lost.
|
||||
.PP
|
||||
\fBFRENAME\fR is useful if you want to save and restore the definition
|
||||
of a user-defined function. For example, you might want to define
|
||||
a \fBmsgprefix\fR function for a block of reminders, but not permanently
|
||||
overwrite any existing definition. You could do something like this:
|
||||
.PP
|
||||
.nf
|
||||
FRENAME msgprefix saved_msgprefix
|
||||
FSET msgprefix(x) "My new prefix: "
|
||||
INCLUDE block_of_reminders.rem
|
||||
FRENAME saved_msgprefix msgprefix
|
||||
.PP
|
||||
The file \fBblock_of_reminders.rem\fR would be executed with the
|
||||
\fBmsgprefix\fR function defined above. After the second FRENAME,
|
||||
\fBmsgprefix\fR would be restored to its previous definition if
|
||||
it had one, or simply unset if it was not previously defined.
|
||||
.PP
|
||||
If you define a user-defined function and then later on redefine it,
|
||||
\fBRemind\fR will issue a warning. If you do not want this warning,
|
||||
then use \fBFUNSET\fR to remove the existing definition before you
|
||||
@@ -5463,10 +5498,14 @@ produce an entry in the calendar (i.e., \fBCAL\fR- and possibly
|
||||
.PP
|
||||
Normally, the body of a reminder is followed by a carriage return.
|
||||
Thus, the results of \fBmsgsuffix()\fR will appear on the next
|
||||
line. If you don't want this, end the body of the reminder with a
|
||||
percentage sign, "%". If you want a space between your reminders,
|
||||
simply include a carriage return (\fBchar(13)\fR) as part of the
|
||||
\fBmsgsuffix()\fR return value.
|
||||
line. If you don't want this, make sure the output of \fBmsgsuffix\fR
|
||||
begins with a backspace. This places the suffix \fIbefore\fR rather than
|
||||
after the carriage return. Here is an example:
|
||||
.PP
|
||||
.nf
|
||||
FSET msgsuffix(x) char(8) + " - suffix on same line"
|
||||
.fi
|
||||
.PP
|
||||
.PP
|
||||
If \fBRemind\fR has problems evaluating \fBmsgprefix()\fR,
|
||||
\fBmsgsuffix()\fR or \fBsortbanner()\fR, you will see a lot of
|
||||
|
||||
@@ -372,6 +372,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
DynamicBuffer buf;
|
||||
Token tok;
|
||||
int y, m, d;
|
||||
int seen_delta = 0;
|
||||
|
||||
DBufInit(&buf);
|
||||
|
||||
@@ -380,7 +381,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
trig->d = NO_DAY;
|
||||
trig->wd = NO_WD;
|
||||
trig->back = NO_BACK;
|
||||
trig->delta = NO_DELTA;
|
||||
trig->delta = -DefaultDelta;
|
||||
trig->until = NO_UNTIL;
|
||||
trig->rep = NO_REP;
|
||||
trig->localomit = NO_WD;
|
||||
@@ -575,7 +576,8 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
|
||||
case T_Delta:
|
||||
DBufFree(&buf);
|
||||
if (trig->delta != NO_DELTA) return E_DELTA_TWICE;
|
||||
if (seen_delta) return E_DELTA_TWICE;
|
||||
seen_delta = 1;
|
||||
trig->delta = tok.val;
|
||||
break;
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ EXTERN INIT( int Hush, 0);
|
||||
EXTERN INIT( int NextMode, 0);
|
||||
EXTERN INIT( int InfiniteDelta, 0);
|
||||
EXTERN INIT( int DefaultTDelta, 0);
|
||||
EXTERN INIT( int DefaultDelta, NO_DELTA);
|
||||
EXTERN INIT( int DeltaOverride, 0);
|
||||
EXTERN INIT( int RunDisabled, 0);
|
||||
EXTERN INIT( int ExpressionEvaluationDisabled, 0);
|
||||
|
||||
@@ -446,8 +446,9 @@ UnsetAllUserFuncs(void)
|
||||
/* */
|
||||
/* RenameUserFunc */
|
||||
/* */
|
||||
/* Rename a user-defined function. Does nothing if oldname */
|
||||
/* does not exist. If newname exists, it is deleted */
|
||||
/* Rename a user-defined function. */
|
||||
/* If newname exists, it is deleted. */
|
||||
/* If oldname exists, it is renamed to newname. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void
|
||||
@@ -460,14 +461,15 @@ RenameUserFunc(char const *oldname, char const *newname)
|
||||
/* Same name; do nothing */
|
||||
return;
|
||||
}
|
||||
/* If oldname does not exist, do nothing */
|
||||
if (!f) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Unset newname */
|
||||
FUnset(newname);
|
||||
|
||||
/* If oldname does not exist, we're done. */
|
||||
if (!f) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Remove from hash table */
|
||||
int h = HashVal_nocase(f->name) % FUNC_HASH_SIZE;
|
||||
cur = FuncHash[h];
|
||||
|
||||
@@ -866,6 +866,7 @@ static SysVar SysVarArr[] = {
|
||||
{"December", 1, STR_TYPE, &DynamicMonthName[11],0, 0 },
|
||||
{"DedupeReminders",1, INT_TYPE, &DedupeReminders, 0, 1 },
|
||||
{"DefaultColor", 1, SPECIAL_TYPE, default_color_func, 0, 0 },
|
||||
{"DefaultDelta", 1, INT_TYPE, &DefaultDelta, 0, 10000 },
|
||||
{"DefaultPrio", 1, INT_TYPE, &DefaultPrio, 0, 9999 },
|
||||
{"DefaultTDelta", 1, INT_TYPE, &DefaultTDelta, 0, 1440 },
|
||||
{"DeltaOverride", 0, INT_TYPE, &DeltaOverride, 0, 0 },
|
||||
|
||||
@@ -2731,6 +2731,7 @@ Variable Value
|
||||
$December "December"
|
||||
$DedupeReminders 0 [0, 1]
|
||||
$DefaultColor "-1 -1 -1"
|
||||
$DefaultDelta 0 [0, 10000]
|
||||
$DefaultPrio 5000 [0, 9999]
|
||||
$DefaultTDelta 0 [0, 1440]
|
||||
$DeltaOverride 0
|
||||
@@ -5860,20 +5861,15 @@ Leaving UserFN square(9) => 81
|
||||
FRENAME nonexistent square
|
||||
REM MSG [square(9)]
|
||||
../tests/test.rem(1143): Trig = Saturday, 16 February, 1991
|
||||
Entering UserFN square(9)
|
||||
x => 9
|
||||
x => 9
|
||||
9 * 9 => 81
|
||||
Leaving UserFN square(9) => 81
|
||||
81
|
||||
|
||||
../tests/test.rem(1143): Undefined function: `square'
|
||||
|
||||
FSET square(x) x*x
|
||||
FRENAME square sq
|
||||
REM MSG [square(9)]
|
||||
../tests/test.rem(1146): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(1146): Undefined function: `square'
|
||||
REM MSG [sq(9)]
|
||||
../tests/test.rem(1147): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(1147): Undefined function: `square'
|
||||
REM MSG [sq(9)]
|
||||
../tests/test.rem(1148): Trig = Saturday, 16 February, 1991
|
||||
Entering UserFN sq(9)
|
||||
x => 9
|
||||
x => 9
|
||||
@@ -5884,7 +5880,7 @@ Leaving UserFN sq(9) => 81
|
||||
|
||||
FRENAME sq square
|
||||
REM MSG [square(9)]
|
||||
../tests/test.rem(1150): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(1151): Trig = Saturday, 16 February, 1991
|
||||
Entering UserFN square(9)
|
||||
x => 9
|
||||
x => 9
|
||||
@@ -5893,18 +5889,67 @@ Leaving UserFN square(9) => 81
|
||||
81
|
||||
|
||||
REM MSG [sq(9)]
|
||||
../tests/test.rem(1151): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(1151): Undefined function: `sq'
|
||||
../tests/test.rem(1152): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(1152): Undefined function: `sq'
|
||||
|
||||
# Test $DefaultDelta
|
||||
SET $DefaultDelta 0
|
||||
CLEAR-OMIT-CONTEXT
|
||||
OMIT 17 Feb 1991
|
||||
REM 18 Feb MSG This should not be seen
|
||||
../tests/test.rem(1158): Trig = Monday, 18 February, 1991
|
||||
|
||||
SET $DefaultDelta 1
|
||||
REM 18 Feb MSG This should also not be seen
|
||||
../tests/test.rem(1161): Trig = Monday, 18 February, 1991
|
||||
|
||||
SET $DefaultDelta 2
|
||||
REM 18 Feb MSG But this should be seen
|
||||
../tests/test.rem(1164): Trig = Monday, 18 February, 1991
|
||||
But this should be seen
|
||||
|
||||
|
||||
REM 18 Feb ++1 MSG Explicit delta should not be seen.
|
||||
../tests/test.rem(1166): Trig = Monday, 18 February, 1991
|
||||
REM 18 Feb ++0 MSG Explicit delta should not be seen.
|
||||
../tests/test.rem(1167): Trig = Monday, 18 February, 1991
|
||||
|
||||
REM 18 Feb +1 MSG Explicit delta should be seen - don't count OMITS
|
||||
../tests/test.rem(1169): Trig = Monday, 18 February, 1991
|
||||
Explicit delta should be seen - don't count OMITS
|
||||
|
||||
REM 18 Feb +0 MSG Explicit delta should not be seen.
|
||||
../tests/test.rem(1170): Trig = Monday, 18 February, 1991
|
||||
|
||||
# Test msgsuffix
|
||||
FSET msgsuffix(x) "On the next line"
|
||||
REM MSG Hello
|
||||
../tests/test.rem(1174): Trig = Saturday, 16 February, 1991
|
||||
Entering UserFN msgsuffix(5000)
|
||||
Leaving UserFN msgsuffix(5000) => "On the next line"
|
||||
Hello
|
||||
On the next line
|
||||
|
||||
FSET msgsuffix(x) char(8) + " on the same line"
|
||||
../tests/test.rem(1176): Function msgsuffix redefined (previously defined at ../tests/test.rem:1173)
|
||||
REM MSG Hello
|
||||
../tests/test.rem(1177): Trig = Saturday, 16 February, 1991
|
||||
Entering UserFN msgsuffix(5000)
|
||||
char(8) => "\b"
|
||||
"\b" + " on the same line" => "\b on the same line"
|
||||
Leaving UserFN msgsuffix(5000) => "\b on the same line"
|
||||
Hello on the same line
|
||||
|
||||
|
||||
# Output expression-node stats
|
||||
DEBUG +s
|
||||
# Don't want Remind to queue reminders
|
||||
EXIT
|
||||
Var hash: total = 141; maxlen = 4; avglen = 2.104
|
||||
Func hash: total = 16; maxlen = 2; avglen = 0.516
|
||||
Func hash: total = 17; maxlen = 2; avglen = 0.548
|
||||
Dedup hash: total = 0; maxlen = 0; avglen = 0.000
|
||||
Expression nodes allocated: 128
|
||||
Expression nodes high-water: 73
|
||||
Expression nodes high-water: 74
|
||||
Expression nodes leaked: 0
|
||||
Parse level high-water: 25
|
||||
|
||||
@@ -13778,6 +13823,7 @@ $DateTimeSep
|
||||
$December
|
||||
$DedupeReminders
|
||||
$DefaultColor
|
||||
$DefaultDelta
|
||||
$DefaultPrio
|
||||
$DefaultTDelta
|
||||
$DeltaOverride
|
||||
|
||||
@@ -1142,6 +1142,7 @@ REM MSG [square(9)]
|
||||
FRENAME nonexistent square
|
||||
REM MSG [square(9)]
|
||||
|
||||
FSET square(x) x*x
|
||||
FRENAME square sq
|
||||
REM MSG [square(9)]
|
||||
REM MSG [sq(9)]
|
||||
@@ -1150,6 +1151,31 @@ FRENAME sq square
|
||||
REM MSG [square(9)]
|
||||
REM MSG [sq(9)]
|
||||
|
||||
# Test $DefaultDelta
|
||||
SET $DefaultDelta 0
|
||||
CLEAR-OMIT-CONTEXT
|
||||
OMIT 17 Feb 1991
|
||||
REM 18 Feb MSG This should not be seen
|
||||
|
||||
SET $DefaultDelta 1
|
||||
REM 18 Feb MSG This should also not be seen
|
||||
|
||||
SET $DefaultDelta 2
|
||||
REM 18 Feb MSG But this should be seen
|
||||
|
||||
REM 18 Feb ++1 MSG Explicit delta should not be seen.
|
||||
REM 18 Feb ++0 MSG Explicit delta should not be seen.
|
||||
|
||||
REM 18 Feb +1 MSG Explicit delta should be seen - don't count OMITS
|
||||
REM 18 Feb +0 MSG Explicit delta should not be seen.
|
||||
|
||||
# Test msgsuffix
|
||||
FSET msgsuffix(x) "On the next line"
|
||||
REM MSG Hello
|
||||
|
||||
FSET msgsuffix(x) char(8) + " on the same line"
|
||||
REM MSG Hello
|
||||
|
||||
# Output expression-node stats
|
||||
DEBUG +s
|
||||
# Don't want Remind to queue reminders
|
||||
|
||||
Reference in New Issue
Block a user