[Remind-Fans] remind+wyrd && in-advance reminders
Frank Terbeck
ft at bewatermyfriend.de
Mon Jan 15 16:14:13 EST 2007
Hi list!
I am using 'in-advance' reminders for birthdays of close friends.
E.g.:
[snip]
REM 07 July +2 MSG Birthday: Anne (%b)
[snap]
That's a great feature. However 'wyrd' handles these incompletely
(IMHO): reminders, that are defined like the above are displayed in
the right windowpane of 'wyrd', where it displays untimed reminders.
That's fine, but it only displays the reminder on the day '%b' expands
to 'today'. The 'in-advance' effect is lost.
The reason for the problem is, that 'wyrd' parses the output of
'remind -s'. I took a look at remind's code, and tried to add the
possibility to output reminders for the event on the preceding days as
well (if requested).
The required changes are rather small, so I'm including them in this
mail. AFAICT, these changes are keeping the current behaviour fully
intact.
This changes the possible call of remind's '-s' which to this:
[snip]
-s[a][+][n] Produce `simple calendar' for n (1) months (weeks)
if '-s' is directly followed by 'a', remind will output
events for 'in-advance' reminders on the days before the actual
event.
[snap]
So, calling 'remind -sa' in wyrd does the trick.
I've been discussing this issue with Paul Pelzl and he told me that he
would include this in wyrd, if remind's output would make it possible.
I mailed the author of remind about this (and included the patch) a
month ago, but sadly I did not get any response.
So, I figured, I should post it here, just in case someone might want
this functionality as well (and maybe remind's author pays more
attention to this list, than he does for strangers in his inbox :> ).
I am using both patches on my laptop system without problems.
These are the changes for remind:
[snip]
diff -ur ../../remind-03.00.24/src/calendar.c ./calendar.c
--- ../../remind-03.00.24/src/calendar.c 2005-09-30 05:29:32.000000000 +0200
+++ ./calendar.c 2006-12-16 02:15:59.000000000 +0100
@@ -648,7 +648,8 @@
/* If trigger date == today, add it to the current entry */
DBufInit(&obuf);
- if (jul == JulianToday) {
+ if (jul == JulianToday ||
+ (DoSimpleCalDelta && trig.delta != NO_DELTA && jul-trig.delta <= JulianToday)) {
NumTriggered++;
if (DoSimpleCalendar || tim.ttime != NO_TIME) {
if (DBufPuts(&obuf, SimpleTime(tim.ttime)) != OK) {
diff -ur ../../remind-03.00.24/src/globals.h ./globals.h
--- ../../remind-03.00.24/src/globals.h 2005-09-30 05:29:32.000000000 +0200
+++ ./globals.h 2006-12-16 02:09:55.000000000 +0100
@@ -42,6 +42,7 @@
EXTERN INIT( int DebugFlag, 0);
EXTERN INIT( int DoCalendar, 0);
EXTERN INIT( int DoSimpleCalendar, 0);
+EXTERN INIT( int DoSimpleCalDelta, 0);
EXTERN INIT( int DoPrefixLineNo, 0);
EXTERN INIT( int MondayFirst, 0);
EXTERN INIT( int Iterations, 1);
diff -ur ../../remind-03.00.24/src/init.c ./init.c
--- ../../remind-03.00.24/src/init.c 2005-09-30 05:29:32.000000000 +0200
+++ ./init.c 2006-12-16 02:09:46.000000000 +0100
@@ -258,6 +287,10 @@
case 's':
case 'S':
DoSimpleCalendar = 1;
+ if (*arg == 'a') {
+ DoSimpleCalDelta = 1;
+ arg++;
+ }
if (*arg == '+') {
arg++;
PARSENUM(CalWeeks, arg);
[snap]
And these are for wyrd:
[snip]
diff -ur wyrd-1.4.1/remind.ml wyrd-1.4.1-new/remind.ml
--- wyrd-1.4.1/remind.ml 2006-07-17 00:29:41.000000000 +0200
+++ wyrd-1.4.1-new/remind.ml 2006-12-16 02:22:20.000000000 +0100
@@ -28,7 +28,7 @@
(* A record for an individual timed reminder, as read from
- * the output of 'remind -s'. *)
+ * the output of 'remind -sa'. *)
type timed_rem_t = {
tr_start : float;
tr_end : float;
@@ -40,7 +40,7 @@
(* A record for an individual untimed reminder, as read from
- * the output of 'remind -s'. *)
+ * the output of 'remind -sa'. *)
type untimed_rem_t = {
ur_start : float;
ur_msg : string;
@@ -188,7 +188,7 @@
(string_of_int tm.Unix.tm_mday) ^ " " ^
(string_of_int (tm.Unix.tm_year + 1900)) in
let full_remind_command =
- !Rcfile.remind_command ^ " -s -l -g -b2 " ^
+ !Rcfile.remind_command ^ " -sa -l -g -b2 " ^
!Rcfile.reminders_file ^ " " ^ rem_date_str
in
let (out_lines, err_lines) = Utility.read_all_shell_command_output full_remind_command in
@@ -555,9 +555,9 @@
(string_of_int tm2.Unix.tm_mday) ^ " " ^
(string_of_int (tm2.Unix.tm_year + 1900)) in
let full_remind_command =
- !Rcfile.remind_command ^ " -n -s -b1 " ^ !Rcfile.reminders_file ^ " " ^
+ !Rcfile.remind_command ^ " -n -sa -b1 " ^ !Rcfile.reminders_file ^ " " ^
rem_date_str1 ^ " > " ^ Rcfile.tmpfile ^ " && " ^ !Rcfile.remind_command ^
- " -n -s -b1 " ^ !Rcfile.reminders_file ^ " " ^ rem_date_str2 ^ " | cat " ^
+ " -n -sa -b1 " ^ !Rcfile.reminders_file ^ " " ^ rem_date_str2 ^ " | cat " ^
Rcfile.tmpfile ^ " - | sort"
in
let (out_lines, err_lines) =
[snap]
Regards, Frank
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925
More information about the Remind-fans
mailing list