mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
- Add $DefaultDelta system variable.
- Make FRENAME delete definition of newname if oldname is not defined. - Document FRENAME, $DefaultDelta and the char(8) hack.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -381,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;
|
||||
|
||||
@@ -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,8 +5889,37 @@ 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
|
||||
|
||||
# Output expression-node stats
|
||||
DEBUG +s
|
||||
@@ -13778,6 +13803,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,24 @@ 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.
|
||||
|
||||
# Output expression-node stats
|
||||
DEBUG +s
|
||||
# Don't want Remind to queue reminders
|
||||
|
||||
Reference in New Issue
Block a user