[Remind-Fans] Calendar view with Saturday first?

hymie! hymie at nasalinux.net
Thu Feb 17 07:50:17 EST 2022


Hi, Tim.

I wrote this years ago, and I have no idea if this patch is still
valid or not.  But maybe it can point you (or somebody) in the
right direction.

--hymie!


On Wed, Feb 16, 2022 at 09:45:57PM -0600, Tim Chase via Remind-fans wrote:
> Normally, invoking the calendar view
> 
>   rem -c
> 
> puts Sunday first.  And I can use -m to put Monday first
> 
>   rem -m -c
> 
> but is there any way to make it put Saturday first?
> 
> I've poked around in the docs but haven't been able to find anything
> other than the Monday-first aspect, so I'm guessing that it's not a
> currently-available feature, but figured I'd at least ask. :-)
> 
> Thanks!
> 
> -tim
-------------- next part --------------
*** init.c.orig	2014-05-09 10:58:34.000000000 -0400
--- init.c	2014-05-09 11:19:42.000000000 -0400
***************
*** 66,72 ****
   *             by non-root, changes environment but not effective uid.
   *  -kcmd    = Run 'cmd' for MSG-type reminders instead of printing to stdout
   *  -iVAR=EXPR = Initialize and preserve VAR.
!  *  -m       = Start calendar with Monday instead of Sunday.
   *  -j[n]    = Purge all junk from reminder files (n = INCLUDE depth)
   *  A minus sign alone indicates to take input from stdin
   *
--- 66,73 ----
   *             by non-root, changes environment but not effective uid.
   *  -kcmd    = Run 'cmd' for MSG-type reminders instead of printing to stdout
   *  -iVAR=EXPR = Initialize and preserve VAR.
!  *  -m[n]    = Start calendar with Monday (or n days after Sunday)
!  *             instead of Sunday.
   *  -j[n]    = Purge all junk from reminder files (n = INCLUDE depth)
   *  A minus sign alone indicates to take input from stdin
   *
***************
*** 233,238 ****
--- 234,243 ----
  	    case 'm':
  	    case 'M':
  		MondayFirst = 1;
+       if (*arg)
+       {
+         PARSENUM(MondayFirst,arg);
+       }
  		break;
  
  	    case 'o':
***************
*** 630,636 ****
      fprintf(ErrFp, " -kcmd  Run `cmd' for MSG-type reminders\n");
      fprintf(ErrFp, " -g[dddd] Sort reminders by date, time, priority, and 'timedness'\n");
      fprintf(ErrFp, " -ivar=val Initialize var to val and preserve var\n");
!     fprintf(ErrFp, " -m     Start calendar with Monday rather than Sunday\n");
      fprintf(ErrFp, " -y     Synthesize tags for tagless reminders\n");
      fprintf(ErrFp, " -j[n]  Run in 'purge' mode.  [n = INCLUDE depth]\n");
      exit(1);
--- 635,641 ----
      fprintf(ErrFp, " -kcmd  Run `cmd' for MSG-type reminders\n");
      fprintf(ErrFp, " -g[dddd] Sort reminders by date, time, priority, and 'timedness'\n");
      fprintf(ErrFp, " -ivar=val Initialize var to val and preserve var\n");
!     fprintf(ErrFp, " -m[n]  Start calendar with Monday (or n days after Sunday)\n");
      fprintf(ErrFp, " -y     Synthesize tags for tagless reminders\n");
      fprintf(ErrFp, " -j[n]  Run in 'purge' mode.  [n = INCLUDE depth]\n");
      exit(1);
*** calendar.c.orig	2014-05-09 10:58:26.000000000 -0400
--- calendar.c	2014-05-09 11:18:00.000000000 -0400
***************
*** 255,262 ****
  	    DoCalendarOneMonth();
  	return;
      } else {
! 	if (MondayFirst) JulianToday -= (JulianToday%7);
! 	else             JulianToday -= ((JulianToday+1)%7);
  
  	if (!DoSimpleCalendar) {
    	    WriteWeekHeaderLine();
--- 255,261 ----
  	    DoCalendarOneMonth();
  	return;
      } else {
!             JulianToday -= ((JulianToday + (1-MondayFirst))%7);
  
  	if (!DoSimpleCalendar) {
    	    WriteWeekHeaderLine();
***************
*** 294,301 ****
  
  /* If it's "Simple Calendar" format, do it simply... */
      if (DoSimpleCalendar) {
! 	if (MondayFirst) wd = JulianToday % 7;
! 	else             wd = (JulianToday + 1) % 7;
  	for (i=0; i<7; i++) {
  	    WriteSimpleEntries(i, OrigJul+i-wd);
  	}
--- 293,299 ----
  
  /* If it's "Simple Calendar" format, do it simply... */
      if (DoSimpleCalendar) {
!       wd = (JulianToday + (1-MondayFirst)) % 7;
  	for (i=0; i<7; i++) {
  	    WriteSimpleEntries(i, OrigJul+i-wd);
  	}
***************
*** 419,426 ****
  
  /* Get the date of the first day */
      FromJulian(JulianToday, &y, &m, &d);
!     if (!MondayFirst) wd = (JulianToday + 1) % 7;
!     else		     wd = JulianToday % 7;
  
  /* Fill in the column entries */
      for (i=wd; i<7; i++) {
--- 417,423 ----
  
  /* Get the date of the first day */
      FromJulian(JulianToday, &y, &m, &d);
!     wd = (JulianToday + (1 - MondayFirst)) % 7;
  
  /* Fill in the column entries */
      for (i=wd; i<7; i++) {
***************
*** 1354,1363 ****
      DRAW(tb);
      goff();
      for (i=0; i<7; i++) {
! 	if (!MondayFirst)
! 	    PrintCentered(DayName[(i+6)%7], ColSpaces, " ");
! 	else
! 	    PrintCentered(DayName[i%7], ColSpaces, " ");
  	gon();
  	DRAW(tb);
  	goff();
--- 1351,1357 ----
      DRAW(tb);
      goff();
      for (i=0; i<7; i++) {
!       PrintCentered(DayName[(i+6+MondayFirst)%7], ColSpaces, " ");
  	gon();
  	DRAW(tb);
  	goff();


More information about the Remind-fans mailing list