mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 06:48:47 +02:00
Add FROM keyword.
Make Calendar delta calculations use ShouldTriggerReminder for proper delta calculation.
This commit is contained in:
34
man/remind.1
34
man/remind.1
@@ -1,4 +1,4 @@
|
||||
.\" $Id: remind.1,v 1.23 2007-07-08 18:21:39 dfs Exp $
|
||||
.\" $Id: remind.1,v 1.24 2007-07-13 03:36:15 dfs Exp $
|
||||
.TH REMIND 1 "1 July 2007"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
@@ -294,7 +294,7 @@ Its syntax is:
|
||||
[\fBSCHED\fR \fIsched_function\fR]
|
||||
[\fBWARN\fR \fIwarn_function\fR]
|
||||
[\fBUNTIL\fR \fIexpiry_date\fR]
|
||||
[\fBSCANFROM\fR \fIscan_date\fR]
|
||||
[\fBSCANFROM\fR \fIscan_date\fR | \fBFROM\fR \fIstart_date\fR]
|
||||
[\fBDURATION\fR \fIduration\fR]
|
||||
[\fBTAG\fR \fItag\fR]
|
||||
<\fBMSG\fR | \fBMSF\fR | \fBRUN\fR | \fBCAL\fR | \fBSATISFY\fR |
|
||||
@@ -648,12 +648,13 @@ trigger date; thereafter, the reminder repeats with the specified
|
||||
period. Similarly, if you specify a weekday, it is used only to calculate
|
||||
the initial date, and does not affect the repetition period.
|
||||
.PP
|
||||
.B SCANFROM
|
||||
.B SCANFROM \fRand\fB FROM
|
||||
.PP
|
||||
The \fBSCANFROM\fR keyword is for advanced \fBRemind\fR programmers
|
||||
The \fBSCANFROM\fR and \fBFROM\fR keywords are for advanced \fBRemind\fR programmers
|
||||
only, and will be explained in the section "Details about Trigger Computation"
|
||||
near the end of this manual. Note that \fBSCANFROM\fR is available only
|
||||
in versions of \fBRemind\fR from 03.00.04 up.
|
||||
in versions of \fBRemind\fR from 03.00.04 up. \fBFROM\fR is available only
|
||||
from 03.01.00 and later.
|
||||
.PP
|
||||
.B PRIORITY
|
||||
.PP
|
||||
@@ -3839,6 +3840,29 @@ amount you should scan back by (7 days in the example above) depends on
|
||||
the number of possible consecutive \fBOMITted\fR days which may occur, and
|
||||
on the range of the movable holiday. Generally, a value of 7 is safe.
|
||||
.PP
|
||||
The \fBFROM\fR clause operates almost like the counterpoint to
|
||||
\fBUNTIL\fR. It prevents the reminder from triggering before the
|
||||
\fBFROM\fR date. For example, the following reminder:
|
||||
.PP
|
||||
.nf
|
||||
REM Mon Thu FROM 23 Jul 2007 UNTIL 2 Aug 2007 MSG Test
|
||||
.fi
|
||||
.PP
|
||||
will trigger on Mondays and Thursdays between 23 July 2007 and
|
||||
2 August 2007 inclusive.
|
||||
.PP
|
||||
\fBFROM\fR is really just syntactic sugar; you could implement
|
||||
the reminder above as follows:
|
||||
.PP
|
||||
.nf
|
||||
REM Mon Thu SCANFROM [trigger(max(today(), '2007-07-23'))] \\
|
||||
UNTIL 2 Aug 2007 MSG Test
|
||||
.fi
|
||||
.PP
|
||||
but that's a lot harder to read. Internally, \fBRemind\fR
|
||||
treats \fBFROM\fR exactly as illustrated using \fBSCANFROM\fR. For
|
||||
that reason, you cannot use both \fBFROM\fR and \fBSCANFROM\fR.
|
||||
.PP
|
||||
Note that if you use one \fBREM\fR command to calculate a trigger date,
|
||||
perform date calculations (addition or subtraction, for example) and
|
||||
then use the modified date in a subsequent \fBREM\fR command, the results
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: calendar.c,v 1.20 2007-07-12 04:31:52 dfs Exp $";
|
||||
static char const RCSID[] = "$Id: calendar.c,v 1.21 2007-07-13 03:36:18 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -663,16 +663,13 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
|
||||
/* If trigger date == today, add it to the current entry */
|
||||
DBufInit(&obuf);
|
||||
/* Suppress time if it's not today */
|
||||
if (jul != JulianToday) {
|
||||
tim.ttime = NO_TIME;
|
||||
}
|
||||
if ((jul == JulianToday) ||
|
||||
(jul > JulianToday &&
|
||||
DoSimpleCalDelta &&
|
||||
trig.delta != NO_DELTA &&
|
||||
jul - abs(trig.delta) <= JulianToday)) {
|
||||
(DoSimpleCalendar && ShouldTriggerReminder(&trig, &tim, jul))) {
|
||||
NumTriggered++;
|
||||
/* Suppress time if it's not today */
|
||||
if (jul != JulianToday) {
|
||||
tim.ttime = NO_TIME;
|
||||
}
|
||||
if (DoSimpleCalendar || tim.ttime != NO_TIME) {
|
||||
if (DBufPuts(&obuf, SimpleTime(tim.ttime)) != OK) {
|
||||
DBufFree(&obuf);
|
||||
|
||||
16
src/dorem.c
16
src/dorem.c
@@ -13,7 +13,7 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: dorem.c,v 1.19 2007-07-12 23:36:03 dfs Exp $";
|
||||
static char const RCSID[] = "$Id: dorem.c,v 1.20 2007-07-13 03:36:18 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
@@ -476,6 +476,12 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
int r;
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
char const *word;
|
||||
if (type == SCANFROM_TYPE) {
|
||||
word = "SCANFROM";
|
||||
} else {
|
||||
word = "FROM";
|
||||
}
|
||||
|
||||
if (t->scanfrom != NO_DATE) return E_SCAN_TWICE;
|
||||
|
||||
@@ -487,7 +493,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
case T_Year:
|
||||
DBufFree(&buf);
|
||||
if (y != NO_YR) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_YR_TWICE]);
|
||||
Eprint("%s: %s", word, ErrMsg[E_YR_TWICE]);
|
||||
return E_YR_TWICE;
|
||||
}
|
||||
y = tok.val;
|
||||
@@ -496,7 +502,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
case T_Month:
|
||||
DBufFree(&buf);
|
||||
if (m != NO_MON) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_MON_TWICE]);
|
||||
Eprint("%s: %s", word, ErrMsg[E_MON_TWICE]);
|
||||
return E_MON_TWICE;
|
||||
}
|
||||
m = tok.val;
|
||||
@@ -505,7 +511,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
case T_Day:
|
||||
DBufFree(&buf);
|
||||
if (d != NO_DAY) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_DAY_TWICE]);
|
||||
Eprint("%s: %s", word, ErrMsg[E_DAY_TWICE]);
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
d = tok.val;
|
||||
@@ -513,7 +519,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
|
||||
default:
|
||||
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_INCOMPLETE]);
|
||||
Eprint("%s: %s", word, ErrMsg[E_INCOMPLETE]);
|
||||
DBufFree(&buf);
|
||||
return E_INCOMPLETE;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: err.h,v 1.5 2007-07-08 16:57:47 dfs Exp $ */
|
||||
/* $Id: err.h,v 1.6 2007-07-13 03:36:18 dfs Exp $ */
|
||||
|
||||
/* Note that not all of the "errors" are really errors - some are just
|
||||
messages for information purposes. Constants beginning with M_ should
|
||||
@@ -207,7 +207,7 @@ EXTERN char *ErrMsg[]
|
||||
"Expecting time after AT",
|
||||
"UNTIL keyword used twice",
|
||||
"Incomplete date specification",
|
||||
"SCANFROM keyword used twice",
|
||||
"FROM/SCANFROM keyword used twice",
|
||||
"Variable",
|
||||
"Value",
|
||||
"*UNDEFINED*",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: finnish.h,v 1.13 2007-07-08 16:57:49 dfs Exp $ */
|
||||
/* $Id: finnish.h,v 1.14 2007-07-13 03:36:21 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Finnish"
|
||||
@@ -284,7 +284,7 @@ EXTERN char *ErrMsg[] =
|
||||
"AT-sanan per\xE4st\xE4 puuttuu aika",
|
||||
"UNTIL-sanaa k\xE4ytetty kahdesti",
|
||||
"Ep\xE4t\xE4ydellinen p\xE4iv\xE4ys",
|
||||
"SCANFROM-sanaa k\xE4ytetty kahdesti",
|
||||
"FROM/SCANFROM-sanaa k\xE4ytetty kahdesti",
|
||||
"Muuttuja",
|
||||
"Arvo",
|
||||
"*M\xC4\xC4RITTELEM\xC4T\xD6N*",
|
||||
@@ -386,7 +386,7 @@ EXTERN char *ErrMsg[] =
|
||||
"AT-sanan per\x84st\x84 puuttuu aika",
|
||||
"UNTIL-sanaa k\x84ytetty kahdesti",
|
||||
"Ep\x84t\x84ydellinen p\x84iv\x84ys",
|
||||
"SCANFROM-sanaa k\x84ytetty kahdesti",
|
||||
"FROM/SCANFROM-sanaa k\x84ytetty kahdesti",
|
||||
"Muuttuja",
|
||||
"Arvo",
|
||||
"*M\x8E\x8ERITTELEM\x8ET\x99N*",
|
||||
@@ -487,7 +487,7 @@ EXTERN char *ErrMsg[] =
|
||||
"AT-sanan per{st{ puuttuu aika",
|
||||
"UNTIL-sanaa k{ytetty kahdesti",
|
||||
"Ep{t{ydellinen p{iv{ys",
|
||||
"SCANFROM-sanaa k{ytetty kahdesti",
|
||||
"FROM/SCANFROM-sanaa k{ytetty kahdesti",
|
||||
"Muuttuja",
|
||||
"Arvo",
|
||||
"*M[[RITTELEM[T\\N*",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: french.h,v 1.11 2007-07-08 16:57:49 dfs Exp $ */
|
||||
/* $Id: french.h,v 1.12 2007-07-13 03:36:21 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "French"
|
||||
@@ -221,7 +221,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Heure attendue apr\350s AT",
|
||||
"Mot-cl\351 UNTIL utilis\351 deux fois",
|
||||
"Sp\351cification de date incompl\350te",
|
||||
"Mot-cl\351 SCANFROM utilis\351 deux fois",
|
||||
"Mot-cl\351 FROM/SCANFROM utilis\351 deux fois",
|
||||
"Variable",
|
||||
"Valeur",
|
||||
"*NON-DEFINI*",
|
||||
@@ -322,7 +322,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Heure attendue apres AT",
|
||||
"Mot-cle UNTIL utilise deux fois",
|
||||
"Specification de date incomplete",
|
||||
"Mot-cle SCANFROM utilise deux fois",
|
||||
"Mot-cle FROM/SCANFROM utilise deux fois",
|
||||
"Variable",
|
||||
"Valeur",
|
||||
"*NON-DEFINI*",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: polish.h,v 1.11 2007-07-08 16:57:49 dfs Exp $ */
|
||||
/* $Id: polish.h,v 1.12 2007-07-13 03:36:21 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Polish"
|
||||
@@ -256,7 +256,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Po AT oczekiwany jest czas",
|
||||
"S\263owo UNTIL u\277yte dw\363krotnie",
|
||||
"Niekompletna specyfikacja daty",
|
||||
"S\263owo SCANFROM u\277yte dw\363krotnie",
|
||||
"S\263owo FROM/SCANFROM u\277yte dw\363krotnie",
|
||||
"Zmienna",
|
||||
"Warto\266\346",
|
||||
"*NIE ZDEFINIOWANE*",
|
||||
@@ -357,7 +357,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Po AT oczekiwany jest czas",
|
||||
"Slowo UNTIL uzyte dwokrotnie",
|
||||
"Niekompletna specyfikacja daty",
|
||||
"Slowo SCANFROM uzyte dwokrotnie",
|
||||
"Slowo FROM/SCANFROM uzyte dwokrotnie",
|
||||
"Zmienna",
|
||||
"Wartosc",
|
||||
"*UNDEFINED*",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: portbr.h,v 1.10 2007-07-08 16:57:49 dfs Exp $ */
|
||||
/* $Id: portbr.h,v 1.11 2007-07-13 03:36:21 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Brazilian Portuguese"
|
||||
@@ -222,7 +222,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Esperando hora apos AT",
|
||||
"Keyword UNTIL usada duas vezes",
|
||||
"Especificacao de data incompleta",
|
||||
"Keyword SCANFROM usada duas vezes",
|
||||
"Keyword FROM/SCANFROM usada duas vezes",
|
||||
"Variavel",
|
||||
"Valor",
|
||||
"*INDEFINIDO*",
|
||||
|
||||
Reference in New Issue
Block a user