[Remind-Fans] feature suggestion: -D[n] increase delta of all reminders by n.

bruce bruce at ironfist.org
Wed Feb 6 13:52:58 EST 2008


I modified remind slightly to support a new feature that is helpful for me.
The feature is the following command line option: 

     -D[n]  increase delta of all reminders by n.

Here's how I use it.  All my reminders have no delta -- I never know what
delta to use anyways.  When I want to see reminders for today, I use "rem".
When I want to see what's happening this week, I use "rem -D7".  And so
on.

Attached is a diff for this feature.  Apologies if the diff is in a poor
format; this is my first time submitting diffs.   (I tried to maintain
the existing coding style throughout).  As it turns out, -D was already
in use, as an undocumented synonym for -d.



diff -ruN remind-03.01.03/src/dorem.c myremind/src/dorem.c
--- remind-03.01.03/src/dorem.c	Wed Sep 26 05:37:29 2007
+++ myremind/src/dorem.c	Wed Feb  6 10:33:25 2008
@@ -785,11 +785,11 @@
     }
 
     /* Move back by delta days, if any */
-    if (t->delta != NO_DELTA) {
+    if (DeltaMod || t->delta != NO_DELTA) {
 	if (t->delta < 0)
 	    jul = jul + t->delta;
 	else {
-	    r = t->delta;
+        r = t->delta + DeltaMod;
 	    while(r && jul > JulianToday) {
 		jul--;
 		if (!IsOmitted(jul, t->localomit)) r--;
diff -ruN remind-03.01.03/src/globals.h myremind/src/globals.h
--- remind-03.01.03/src/globals.h	Sat Aug 11 19:22:31 2007
+++ myremind/src/globals.h	Wed Feb  6 10:20:47 2008
@@ -50,6 +50,7 @@
 EXTERN  INIT(   int     CalWidth, 80);
 EXTERN  INIT(   int     CalWeeks, 0);
 EXTERN  INIT(   int     CalMonths, 0);
+EXTERN  INIT(   int     DeltaMod, 0);
 EXTERN  INIT(	int 	Hush, 0);
 EXTERN  INIT(	int 	NextMode, 0);
 EXTERN  INIT(	int 	InfiniteDelta, 0);
diff -ruN remind-03.01.03/src/init.c myremind/src/init.c
--- remind-03.01.03/src/init.c	Tue Sep  4 11:02:24 2007
+++ myremind/src/init.c	Wed Feb  6 10:28:39 2008
@@ -39,6 +39,7 @@
  *             simple calendar format.
  *  -r       = Disallow RUN mode
  *  -c[n]    = Produce a calendar for n months (default = 1)
+ *  -D[n]    = modify delta for all reminders by N (N must be > 0)
  *  -w[n,n,n] = Specify output device width, padding and spacing
  *  -s[n]    = Produce calendar in "simple calendar" format
  *  -p[n]    = Produce calendar in format compatible with rem2ps
@@ -304,7 +305,9 @@
 		    if (!CalMonths) CalMonths = 1;
 		}
 		break;
-
+        case 'D':
+            PARSENUM(DeltaMod, arg)
+        break; 
 	    case 's':
 	    case 'S':
 		DoSimpleCalendar = 1;
@@ -360,7 +363,6 @@
 		break;
 
 	    case 'd':
-	    case 'D':
 		while (*arg) {
 		    switch(*arg++) {
 		    case 'e': case 'E': DebugFlag |= DB_ECHO_LINE; break;
@@ -516,6 +518,7 @@
     fprintf(ErrFp, " -r     Disable RUN directives\n");
     fprintf(ErrFp, " -c[n]  Produce a calendar for n (default 1) months\n");
     fprintf(ErrFp, " -c+[n] Produce a calendar for n (default 1) weeks\n");
+    fprintf(ErrFp, " -D[n]  increase delta of all reminders by n\n");
     fprintf(ErrFp, " -w[n[,p[,s]]]  Specify width, padding and spacing of calendar\n");
     fprintf(ErrFp, " -s[a][+][n] Produce `simple calendar' for n (1) months (weeks)\n");
     fprintf(ErrFp, " -p[a][n] Same as -s, but input compatible with rem2ps\n");





More information about the Remind-fans mailing list